|
Get Filename and Line Number using grep
Hi,
I am using the Korne shell to try and get the filename, line number and the line of text using grep e.g.
find ./ -type f -name "*.java" -exec grep -nf test.txt '{}' \;
(test.txt contains strings to search)
will return the line number and the line of text.
grep -l would return the filename but grep -ln doesnt return the filename, the line number and the line of text.
Is it possible to do this using grep ?, or would I have to use something like awk ?
I would appreciate if anybody can help me
thanks
Last edited by ceemh3; 09-11-2007 at 10:22 AM..
|