I use recursive grep a lot to find source files with specific content.
grep -Rni "myfunc" .
On large codebases, this can get slow, so I use –incldue to restrict/whitelist extensions.
grep -Rni --include=*.java "myfunc" .
However, it would be more efficient to exclude (prune) whole subdirectories, I'm thinking:
grep -Rni --exclude=/.svn/ "myfunc" .
But the –exclude only supports file patterns like *.java above.
How can I exclude directories?
Best Answer
You might look into ack.
I've just started using it but it seems well-suited for this.