Hello,
I would like to search inside a folder and its sub-folders for the name of a file that contains a specific text string.
What command should I run?
Thanks,
David
Printable View
Hello,
I would like to search inside a folder and its sub-folders for the name of a file that contains a specific text string.
What command should I run?
Thanks,
David
Code:find -iname <string>
find -iname *hello*
Hi,
I didn't explain myself correctly. I don't want to find a "file name" that includes a string but rather the "name of a file" where the "file itself contains a string".
Thanks,
David
It will fine string abc in all files in folder and subfolders.Code:grep 'abc' -r *
Check manual of grep here. You can use sed for more efficient results but I am not familiar with it.
Not sure how a stream editor can give more efficient results than grep, but in casper's example use grep's -l option to get the names of the files containing the wanted string, rather than every matching line.