Wondering if anyone can help me, I'm very rusty with bash and seem to hit a bit of an impasse.
I'm storing a list of strings in a file and would like to read the file and pipe each line returned to grep which in turn searches a directory for files containing the string.
Initial attempt:
cat filename | grep -lr *
However this is not returning any output.
Can anyone give me some directions on the best approach?
Best Answer
Avoid that useless use of
cat
. You can of course solve this withxargs
and the like. But that's over-complex compared to a simplewhile
loop.