grep pattern filename
To search for the pattern in all files in the current directory and the sub-directories recursively, what needs to be substituted in filename?
grep pattern filename
To search for the pattern in all files in the current directory and the sub-directories recursively, what needs to be substituted in filename?
The following code searches the current directory (specified with a dot) and for each file (-type f) found it runs the command given substituting the file name for {}
find . -type f -exec grep pattern {} /dev/null \;
The /dev/null will cause grep to display the filename where a match for patternis found because there is more than one 'file' listed for the command.
The \; ends the -exec section of the find command as a whole. It would be possible to have a variety of commands all in sequence.
I hope that this helps.
Robin
Liverpool/Blackburn
UK