Exclude .svn directories from grep
This question already has an answer here:
If you have GNU Grep, it should work like this:
grep --exclude-dir=".svn"
If happen to be on a Unix System without GNU Grep, try the following:
grep -R "whatever you like" *|grep -v ".svn/*"
If you use ack (a 'better grep') it will handle this automatically (and do a lot of other clever things too!). It's well worth checking out.
For grep >=2.5.1a
You can put this into your environment (eg .bashrc
)
export GREP_OPTIONS='--exclude-dir=".svn"'
PS: thanks to Adrinan, there are extra quotes in my version:
export GREP_OPTIONS='--exclude-dir=.svn'
链接地址: http://www.djcxy.com/p/19660.html
上一篇: 我如何使用grep在文件夹中查找单词?
下一篇: 从grep中排除.svn目录