From: no.top.post on
Someone kindly provided the following very useful one-liner
to find all <recent> files containing 'a string':-

find ./ -ctime -2 -exec grep -l "a string" {} \;

Now I want command/s to find files containing MULTIPLE strings like:
"dog", "cat", "fish"

== TIA

From: Robert Riches on
On 2010-07-27, no.top.post(a)gmail.com <no.top.post(a)gmail.com> wrote:
> Someone kindly provided the following very useful one-liner
> to find all <recent> files containing 'a string':-
>
> find ./ -ctime -2 -exec grep -l "a string" {} \;
>
> Now I want command/s to find files containing MULTIPLE strings like:
> "dog", "cat", "fish"
>
>== TIA

Is egrep what you're looking for?

--
Robert Riches
spamtrap42(a)jacob21819.net
(Yes, that is one of my email addresses.)
From: root on
no.top.post(a)gmail.com <no.top.post(a)gmail.com> wrote:
> Someone kindly provided the following very useful one-liner
> to find all <recent> files containing 'a string':-
>
> find ./ -ctime -2 -exec grep -l "a string" {} \;
>
> Now I want command/s to find files containing MULTIPLE strings like:
> "dog", "cat", "fish"
>
>== TIA
>

Use egrep:
egrep -l "dog\|cat\|fish" {}
From: Helmut Hullen on
Hallo, root,

Du meintest am 27.07.10:

>> Someone kindly provided the following very useful one-liner
>> to find all <recent> files containing 'a string':-
>>
>> find ./ -ctime -2 -exec grep -l "a string" {} \;
>>
>> Now I want command/s to find files containing MULTIPLE strings like:
>> "dog", "cat", "fish"

> Use egrep:
> egrep -l "dog\|cat\|fish" {}


Sorry - doesn't work here.

egrep -l "\(dog\|cat\|fish\)" *

works, but

find . -exec egrep -l "\(dog\|cat\|fish\)" {} \;

doesn't work.

Viele Gruesse
Helmut

"Ubuntu" - an African word, meaning "Slackware is too hard for me".

From: Joost Kremers on
Helmut Hullen wrote:
> Sorry - doesn't work here.
>
> egrep -l "\(dog\|cat\|fish\)" *
>
> works, but
>
> find . -exec egrep -l "\(dog\|cat\|fish\)" {} \;
>
> doesn't work.

try

find . -ctime -2 | xargs egrep -l "\(dog\|cat\|fish\)"


--
Joost Kremers joostkremers(a)yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)