Date: Fri, 26 Sep 2008 08:36:16 -0400 From: Steve Bertrand <steve@ibctech.ca> To: Mel <fbsd.questions@rachie.is-a-geek.net> Cc: freebsd-questions@freebsd.org Subject: Re: Iterate through directories and search into files Message-ID: <48DCD740.2000305@ibctech.ca> In-Reply-To: <200809261432.17656.fbsd.questions@rachie.is-a-geek.net> References: <48DCD201.2000402@ibctech.ca> <48DCD403.8010603@ibctech.ca> <200809261432.17656.fbsd.questions@rachie.is-a-geek.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Mel wrote:
> On Friday 26 September 2008 14:22:27 Steve Bertrand wrote:
>> Steve Bertrand wrote:
>>> Hi everyone,
>>>
>>> I have a list of directories:
>>>
>>> - a..z and 2003..2008
>>>
>>> ...inside of a single directory.
>>>
>>> Can someone advise what the shortest shell pipeline would be to search
>>> for two words (on two separate lines) within all files located only the
>>> alpha directories, and then print the filename to STDOUT?
>> ...what I meant to say was that both patterns will be on the SAME line,
>> as a single instance example, I would do:
>>
>> cat a/file.fil | grep -i comment | grep 355
>
> find ./[a-z]* -type f -exec grep -il 'comment.*355' {} +
Beautiful, thanks!
Steve
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48DCD740.2000305>
