When using find
, how do I return the file name and the line number when searching for a string? I manage to return the file name in one command and the line numbers with another one, but I can't seem to combine them.
File names: find . -type f -exec grep -l 'string to search' {} \;
Line numbers: find . -type f -exec grep -n 'string to search' {} \;