grep multiple patterns in number of files

Hi,

I want to list the files containing a no of pattern

like for single string i can use

grep -l "string" *

This command will enlist the files containg this string. Similarly i would like to use for multiple string.

I like to enlist file names having string1 and string 2

Can anyone please help me !!

Thanks

The following example search for files containing the strings AA and DD :

$ more f?.txt
::::::::::::::
f1.txt
::::::::::::::
AA
BB
CC
DD

::::::::::::::
f2.txt
::::::::::::::
AA
BB
CC

::::::::::::::
f3.txt
::::::::::::::
BB
CC
DD

::::::::::::::
f4.txt
::::::::::::::
BB
CC

$ grep -l AA $(grep -l DD f?.txt) /dev/null
f1.txt
$

Jean-Pierre.

Thanks a lot !! It worked :slight_smile: