Avoid .svn folder when using grep
Hi
When I am using grep f.ex. "grep -ire 'something' ." and theres an .svn folder, grep will go trough that folder also. How can I exclude folders and/or files? |
Can't remember if grep does it someway, but first thing I'd do is first use find to create a list of the directories you want, excluding those you don't, and then using that as a start-off for grep.
|
This should work:
find . -path "*.svn" -prune -o -exec grep -ie "something" {} \; The -prune command is saying to ignore that path. We use the * so as you recurse through the tree with find, we still omit the .svn dir. Note that you do not need to recurse through each directory with grep in this case. |
All times are GMT -5. The time now is 01:32 AM. |