I tried now for a while to
- read from a file test.txt (which has two lines "aaaa" and "bbbb")
- take these lines to search the strings within a folder and its subfolders
My solution looks like this:
while read line
do echo $line
grep -irl $line /home 2>/dev/null
done < test.txt
If I replace $line
with aaaa
it finds the files where aaaa
is written in, with $line
it doesn't work...?
Maybe you have an idea?
test.txt
has Windows/DOS line endings? Does it work after you rundos2unix test.txt
?$line
ingrep
?$line
contains something you don't expect, but maybe I'm wrong. You could do anecho "$line" | xxd
and compare the output.-f
option is for:grep -irl -f test.txt dir