使用 grep 查找文件
我想找到包含一些我感兴趣的内容的文件。我希望该文件的扩展名为 .h 或 .cc。有没有比输入两次更快的方法:
grep -r "some stuff" * --include="*.h"
grep -r "some stuff" * --include="*.cc"
?
I want to find file containing some interesting stuff for me. I want that file to have extension .h or .cc. Is there some faster way than typing two times:
grep -r "some stuff" * --include="*.h"
grep -r "some stuff" * --include="*.cc"
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在 .bashrc 中定义了一个 bash 函数,它在当前目录中递归搜索,但跳过已知不感兴趣的文件和目录:
通过调用它
搜索到的模式实际上是彩色的! :-)
I have a bash function defined in my .bashrc which searches in the current directory recursively but skips files and directories known to not be of interest:
Call it via
The searched pattern is actually colored! :-)