Re: find in conjuction with grep

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

 



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



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux