Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Concerning spaces' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Concerning spaces
Authored by: lullabud on Apr 14, '05 01:36:00PM
You can use double-quotes around your search-string if you have to use spaces or other strange characters like single quotes, etc. The syntax used here used throughout a wide array of *nix applications. If you become familiar with it you will be much more at home in the terminal. You can als- put a back-slash before a space. The following commands do the same thing.

find "/some/path name/with spaces/" -type f -exec grep -i -q "spaced string within file" "{}" \; -exec open "{}" \;

find /some/path\ name/with\ spaces/ -type f -exec grep -i -q spaced\ string\ within\ file "{}" \; -exec open "{}" \;


The first exmple can be demonstrated by typing open " and then using tab-completion to finish up a filename that has spaces. The second can be demonstrated by dragging a filename with spaces onto the terminal window.

[ Reply to This | # ]
Syntax Mistake in example
Authored by: lullabud on Apr 14, '05 02:04:22PM
Gah, I don't know what happened but those semi-colons need to be back-slashed in the -exec command.

find /some/path/ -name '*.html' -exec open "{}" \;

[ Reply to This | # ]