Grepping through repo directories (aka the ".svn/" problem)

It's super annoying when you're looking for a string in your code, so you do a recursive grep, only to get a ton of matches within svn's ".svn" directories.

Here's a solution:

Inside your ~/.bash_profile, insert this line:


alias rgrep="find . -follow \( -name ".svn" \) -prune -o -print | xargs grep -Hn"

Save it, then log out and back in. Now instead of

grep -ir "sprintf" *

do

rgrep sprintf

Cake!