Re: using find with grep
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.
--
-------------------------------------------------------
| When life hands you lemons, ask for tequila and salt. |
-------------------------------------------------------
Reply to: