首页 > 技术文章 > 使用grep查找字符串

pinganzi 2018-03-22 17:36 原文

如下:

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

推荐阅读