How can I exclude directories from grep -R?

How can I exclude directories from grep -R?,第1张

概述‘--exclude-dir=dir’ Exclude directories matching the pattern dir from recursive directory searches.
‘--exclude-dir=dir’    Exclude directorIEs matching the pattern dir from recursive directory searches. 
= ) provide:

‘--exclude-dir=dir’    Exclude directories matching the pattern dir from recursive directory searches. 

So you can do:

grep -R --exclude-dir=node_modules 'some pattern' /path/to/search
# grep -Ri --exclude-dir "/var/www/directory_to_exclude" "search pattern" /var/wwwOr multiple directorIEs:# grep -Ri --exclude-dir "/var/www/directory_to_exclude" --exclude-dir "/var/www/another_directory_to_exclude" "search pattern" /var/wwwOr wildcard: # grep -Ri --exclude-dir "*.svn" "search pattern" *Or with only exclude: # grep -Rli --exclude="*\.svn*" "search string" /var/www 总结

以上是内存溢出为你收集整理的How can I exclude directories from grep -R?全部内容,希望文章能够帮你解决How can I exclude directories from grep -R?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/1050650.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存