使用grep查找字符串

如下:

grep -r 'target string' --exclude='pattern' dir/

例子:

grep -r Debug --exclude='*.js' ./

 

查找本目录下除了js文件以外的所有文件,找到包含‘Debug’字符串的文本行。

 

 

ref: https://unix.stackexchange.com/questions/125360/how-to-specify-matching-patterns-while-excluding-some-files-having-a-pattern-in

posted @ 2018-03-22 17:36  圆旭  阅读(423)  评论(0编辑  收藏  举报