what is the best way to do this?
views:
25answers:
2Add the --files-with-matches option if you only want a list of files and not the text printed from the grep call.
Ian C.
2010-03-12 16:00:39
this is the flag i was looking for - thanks!
amitlicht
2010-03-12 16:04:27
A:
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.
Amit Kumar
2010-03-12 16:08:44