[SWLUG] Any tips on locating this file.

Justin Mitchell justin at discordia.org.uk
Thu Aug 19 13:45:43 UTC 2004


On Thu, 2004-08-19 at 14:26, pbhj wrote:
> How about:
> 
> grep -H -e wordToFind -f ./*

a curious choice of options, and i'm afraid, not entirely correct for
this case, let me explain why:

the -H will indeed print the filenames, as you said
the -e is superflous unless your word actually starts with a minus
but -f tells it to look in the next given filename for the list of words
to search for, which is definitely not what you want, especially as its
followed by a wildcard pattern, so it will use the contents of the first
file on the list as the patterns to look for in the rest of the files in
the current directory.

this also will not recurse down any directories, it will only search the
files in the current directory.

A much better version might be: 
grep -Hr wordToFind /






More information about the Swlug mailing list