The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 09-11-2007
fazliturk fazliturk is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 45
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