find in conjuction with grep

Nifty Hat Mitch mitch48 at sbcglobal.net
Fri Aug 13 07:06:57 UTC 2004


On Wed, Aug 11, 2004 at 02:31:04PM -0400, Kevin Old wrote:

> 
> I've been using
> find . -exec grep "phrase I want" {} \;
> for quite a while to search recursively through directories and files
> to find a phrase or word.
> 
> The results I get back are simply the line(s) that contained the
> phrase, but no path or filename.

Try:
   find . -exec grep "phrase I want" {} /dev/null \;

You need to look at two files for grep without special flags to give
you the file name.  Or you need to tell grep to print the file name.

Also Try:
   find . -exec grep -H "phrase I want" {}  \;


-- 
	T o m  M i t c h e l l 
	Just say no to 74LS73 in 2004





More information about the fedora-list mailing list