|
grep -l doesn't gives file name.it gives only the file name.So your code is true . Then what is wrong .
if use grep like these ;
grep -nf test.txt file1 file2 ...
grep -nf test.txt *
grep -nf test.txt *.java
it gives filename:linenumber:text
the problem is when you give file name to grep so it assumes that you know the file name so it doesnt write file name
when you use your code above when it finds a file it executes
grep -nf test.text filexx(known file)
you must find a way of using
grep -nf text.txt *.java
|