Find files contains specific line

Hi, I need a command that could search the specified directory (and its sub directories) and file contents. In the result display path of the file and string

The command:

 find <search_dir> -exec grep <search_string>  {} \; 

works but doesn't show the file name

Thanks

Hi.

grep -l

will show the filenames.

1 Like

Try using the below one...~!
find <directory> -exec grep -li "pattern" {} \;