I walked around the world and I can not find the answer I am looking for.
Let's say I have a file text1.txtin a directory mydirwhose contents are:
one
two
and the other text2.txt, also in mydir, the contents of which:
two
three
four
I am trying to get a list of files (for a given directory) that contain all (not any) of the patterns I am looking for. In the example I cited, I am looking for a way out somewhere along the lines:
./text1.txt
or
./text1.txt:one
./text1.txt:two
The only thing I managed to find was matching any patterns in a file or matching several patterns in a single file (which I tried to distribute to the entire directory, but got errors using grep).
Any help is greatly appreciated.
Edit-Things I tried
grep "pattern1" < ./* | grep "pattern2" ./*
ambiguous redirection
grep 'pattern1'|'pattern2' ./*
,