I want to search line-by-line for a string in a file, and I want to do this to a series of files in a directory. I'm doing this in tcsh
This works fine to do the search:
while read i; do grep $i file2; done <file1.txt
This also works fine to read a directory:
foreach file ('/bin/ls *.txt')
echo $file
end
but if I try and combine the two, no joy.
foreach file ('/bin/ls *.txt')
while read i; do grep $i file2; done <$file
end
Help please!