2010-03-12 22 views

回答

3

grep -R <some_string> <directory>

+0

如果您只需要一個文件列表而不是從grep調用打印的文本,請添加--files-with-matches選項。 – 2010-03-12 16:00:39

+0

這是我正在尋找的國旗 - 謝謝! – amitlicht 2010-03-12 16:04:27

0

另一種選擇是:

find . -name "*.cpp" | xargs grep some_string 

,如果你想將搜索限制在特定的文件模式或類型。使用find,您還可以指定要搜索的最大深度。

相關問題