find in conjuction with grep

Aaron Gaudio prothonotar at tarnation.dyndns.org
Wed Aug 11 20:06:10 UTC 2004


On Wed, 2004-08-11 at 12:45 -0700, Kevin Wang wrote:
> to be a little more explicit and to throw an extra trick in your bag,
> I usually write tihs up (in scripts, not typically on the command
> line) as:
> 
> find . -type f -print0 | xargs -0 egrep 'want | phrase' /dev/null
> 
> why the /dev/null?  grep will only prepend the filename in the output
> if there's more than 1 file.  This guarantees that you'll always have
> at least 2 files.

Or, you could use egrep -H :)





More information about the fedora-list mailing list