find . | xargs grep 'string' -sl
The -s is for summary and won't display warning messages such as
grep: ./directory-name: Is a directory
The -l is for list, so we get just the filename and not all instances of the match displayed in the results.
Also useful is, if you want to limit the files to be searched for.
No comments:
Post a Comment