[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grep question




On Tuesday, Dec 7, 2004, at 20:49 US/Central, Charlie Brune wrote:
> How about:
>
>      find -type f -exec grep -H "this_string" \;
>
> The "-H" grep option will show the name of the file.

Just being picky: you need to specify a directory and the argument to 
grep:

  $ find . -type f -exec grep -H "this_string" {} \;

Also, if I did use 'find', I would use xargs instead of the -exec:

  $ find . -type f -print0 | xargs -0 grep -H "this_string"

but that's just my preference.

Regards,
- Robert
http://www.cwelug.org/downloads
Help others get OpenSource.  Distribute FLOSS for
Windows, Linux, *BSD, and MacOS X with BitTorrent


-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.