Nov 7, 2008
[HowTo] Find files that contain a given string
If you are searching in current folder, sometimes command like:
cat * | grep -i “string” *will print the filename and a line that matched the string. But this will not “search” in subfolders, and will not work on some Linux distros.
The right (my) way would be:
find /path/to/folder -type f -exec grep “string” {} \; -printThis will print a line that matched the string, and filename on the next line.
No Comments, Comment or Ping
Reply to “[HowTo] Find files that contain a given string”