I want to find list of files (under some directory, recursively) in which the string <some_string> is written
what is the开发者_StackOverflow中文版 best way to do this?
grep -R <some_string> <directory>
Another option is:
find . -name "*.cpp" | xargs grep some_string
if you want to restrict the search to particular file patterns or types. With find
, you can also specify the maximum depth to search.
精彩评论