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

Re: searching inside files with find, cat and grep as a oneliner ...



On Fri, Sep 17, 2010 at 06:32:06PM +0000, Albretch Mueller wrote:
> > if you need certain extension, you don't even need cat and find, it's all about grep:
> 
> > $ grep 'string' *.extension
> ~
>  The thing is that I need to know in which file the pattern was found
> and as you guys suggested:
> ~
> $ find -name '*.extension' -exec grep -H 'pattern' {} \;
> ~
>  does it
Um... Well, single grep will show you filename as well, because (quoting the
manpage):

-H, --with-filename
    Print the file name for each match.  This is the default when there is more
    than one file to search.

-- 
Regards,
Alexander Batischev

1024D/69093C81
F870 A381 B5F5 D2A1 1B35  4D63 A1A7 1C77 6909 3C81

Attachment: signature.asc
Description: Digital signature


Reply to: