How can I exclude directories from grep -R?
来源:互联网 发布:淘宝好评晒图怎么删掉 编辑:程序博客网 时间:2024/05/01 06:44
‘--exclude-dir=dir’ Exclude directories matching the pattern dir from recursive directory searches.
Recent versions of GNU Grep (>= 2.5.2) 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 Exclude Directory
# grep -Ri --exclude-dir "/var/www/directory_to_exclude" "search pattern" /var/www
Or multiple directories:# grep -Ri --exclude-dir "/var/www/directory_to_exclude" --exclude-dir "/var/www/another_directory_to_exclude" "search pattern" /var/www
Or wildcard:
# grep -Ri --exclude-dir "*.svn" "search pattern" *
Or with only exclude: # grep -Rli --exclude="*\.svn*" "search string" /var/www
0 0
- How can I exclude directories from grep -R?
- How to exclude .svn directories from search in Eclipse?
- How can i specify the resource to get from R.res.drawable dynamically?
- How can I run an EXE from within my application?
- How can I create ePub files from my books?
- How can I invoke functions on QObjects from another thread?
- Android - How can I call Java methods from C++
- How can I read single characters from the terminal?
- How can I use Server.MapPath() from global.asax?
- How can I use Server.MapPath() from global.asax?
- How can I fix a locale warning from perl?
- How can I extract the SIGHASH flags from the signature?
- How Can I Stop
- How can I play a wav-file from memory or BLOB-field?
- How can I get the next auto increment value from mssql?
- How Can I Launch The Appstore App Directly from my Application
- Windows SDK Registry: How can I read in data from the registry?
- How can I get the IPv4 address of an interface in linux from C code ?
- 【线性规划与网络流24题 10】餐巾计划
- 用于软件包管理的21个Linux YUM命令 转载
- centos mongodb安装及简单实例
- HttpURLConnection方式、HttpClient方式发送get、post数据给服务端
- RPM安装命令总结--转载
- How can I exclude directories from grep -R?
- mybatis_SQL映射(5)_缓存
- 主机访问虚拟机中linux上的web服务
- 解决 ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)异常
- Install Redis on CentOS 6.4--转
- 解决两台centos虚拟机Telnet服务无法联机的问题
- linux主机间复制文件
- 清除linux缓存命令
- CATransition的动画效果类型及实现方法