What I am after is almost exactly the same as can be found here, but I want theformat line number, separator, filename, newline in the results, thus displayingthe line number at the beginning of the line, not after the filename, and withoutdisplaying the line containing the match. The reason why this format is preferable is that(a) the filename might be long and cryptic and contain the separator which the tool uses to separate the filename from the line number, making it incredibly difficult to use awk to achieve this, since the pattern inside the file might also contain the same separator. Also, line numbers at the beginning of the line will be aligned better than if they appear after the filename. And the other reason for this desired format is that (b) the lines matching the pattern may be too long and mess up the one line per row property on the output displayed on standard out (and viewing the output on standard out is better than having to save to a file and use a tool likevi to view one line per row in the output file).How can I recursively search directories for a pattern and just print out file names and line numbersNow that I've set out the requirement, consider this:Ack is not installed on the Linux host I'm using so I cannot use it.If I do the following, the shell executes find . and substitutes 'find .`with a list of absolute paths starting at the current working directory andproceeding downwards recursively:grep -n PATTERN `find .`then the -n prints the line number, but not where I want it. Also, for some reason I do not understand, if a directory name includes the PATTERN, then grep matches it in addition to the regular files that contain the pattern. This is not what I want,so I use:grep -n PATTERN `find . -type f`I also wanted to change this command so that the output of find is passed on togrep dynamically. Rather than having to build the entire list of absolute pathsfirst and then pass the bulk of them to grep, have find pass each line to grepas it builds the list, so I tried:find . -exec grep -n PATTERN  '{}' \;which seems like the right syntax according to the man page but when I issuethis command the Bash shell executes about 100 times slower, so this is notthe way to go.In view of what I described, how can I execute something similar to this commandand obtain the desired format. I have already listed the problems associatedwith the related post.
recursive search for a pattern, then for each match print out the specific SEQUENCE: line number, file name, and no file contents
bash;find;grep;awk