On Fri, Sep 17, 2010 at 06:08:18PM +0000, Albretch Mueller wrote:
> I need to:
> ~
> search for files using a pattern (say all files with a certain extension)
Is this part so complicated that bash can't handle it? I mean, if you need
certain extension, you don't even need cat and find, it's all about grep:
$ grep 'string' *.extension
> ~
> then search inside each of the found files for a word or regexp pattern
But if you really want to use find, here's something you may try:
$ find -name '*.extension' -exec grep -H 'pattern' {} \;
(-name may be substituted by -iname if you don't want case sensitivity).
This oneliner would work exactly the same as first one - each match would be
preceded with a filename delimited from a matching string itself by a semicolon
(:)
Hope it helps.
--
Regards,
Alexander Batischev
Attachment:
signature.asc
Description: Digital signature