使用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

原文地址:https://www.cnblogs.com/pinganzi/p/8625237.html