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

Re: find in conjuction with grep



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 :)



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