Hi I would like to write a simple script that would use grep to search through a list of files. The current code looks something similar to this:
a= file1.txt
b= file2.txt
for
do
grep '$a.*$b' /root/listoffiles/*php >> found.txt
a= file1.txt
b= file2.txt
for
do
grep '$a.*$b' /root/listoffiles/*php >> found.txt
done
file1file1 and file2file2 are both word lists. So this would search through the destination having multiple criteria.For For example $a$a could be "hello" and b$$b "world" or the second line could be "red" and "tshirt". If it finds anything with two matching criteria then it would just save it into the file. The loop that I am using is not working and not efficient enough. I would like to get only the results for meeting criteria. Any suggestions? Thanks in advance