Advertisement
答案 (5)
解决方案找到了!
得分
299
2010-07-13 09:47:11 +0000
grep -r 'text goes here' path_goes_here
Ignacio Vazquez-Abrams
http://superuser.stackexchange.com/users/62
Advertisement
Advertisement
得分
12
2016-03-03 14:07:18 +0000
- 通过Ack
brew install ack
ack "text goes here"
- 通过 find
find . |grep "text goes here"
- 通过 grep
grep -RnslI "text goes here"
``` &001
Anant Gupta
http://superuser.stackexchange.com/users/62
Advertisement
得分
2
2017-06-01 15:27:29 +0000
Ignacio的回答很好,帮助我找到了包含某些文本的文件。我遇到的唯一问题是,当运行这个命令时,所有的文件都会被列出,其中包括一个没有显示图案的文件。
如果你在命令中加入No such file or directory,如:-s ; grep -lr "text pattern" ./ -s,它将只显示出包含图案的文件。如何让grep不打印出 “No such file or directory "错误?](https://stackoverflow.com/questions/6426363/how-can-i-have-grep-not-print-out-no-such-file-or-directory-errors)

