加入收藏 | 设为首页 | 会员中心 | 我要投稿 济源站长网 (https://www.0391zz.cn/)- 数据工具、数据仓库、行业智能、CDN、运营!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

How can I exclude directories from grep -R?

发布时间:2021-01-18 13:47:03 所属栏目:Linux 来源:网络整理
导读:‘--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

‘--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

(编辑:济源站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读