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

Re: using find with grep



Ashish Ariga writes:
On Wed, May 05, 2004 at 06:52:46PM -0500, Rick Weinbender wrote:
I have an expression that searches within files
of a particular type and displays the output.
But I would ALSO like it to display the directory
for each find occurence.
The command below works, but won't give me
the directory. find /home -name *.txt -exec grep searchstring {} \; Any help would be much appreciated, -Rick

Try
find /home -name "*.txt" -exec grep --with-filename searchstring {} \;
If that doesn't do it then this surely will
find /home -name "*.txt" -exec grep searchstring {} /dev/null \; Ashish.
*******************************
Thanks Ashish and everyone for the help.
That worked great!
-Rick


Reply to: