A common issue when you search the code base is the svn folder or backup files shows up as well as the result you are interested in.
A solution I used before is to pipe the result into another grep and use -v to filter out svn results, like following :
grep -R pattern path/to/search/ |grep -v svnIt works fine, but have two issues, it scan all svn folders (usually it's a not problem, but if you have huge code base like me to work on, it's a pain), secondly, it ruins the wonderful colour highlight grep give to us as a free gift.
A better solution would be using the 'exclude' and 'exclude-dir' options from grep, like following :
grep --exclude-dir=\.svn --exclude=\*~ pattern path/to/search/ -Rn
It's fantastic, it exclude all .svn folders, and also exclude all files ended '~' (some editor use it a backup file), and it also keep the colour highlighted result.
One step further, I added it to the .bashrc file, so it becomes the default setting and I don't need to type that much :
export GREP_OPTIONS="--exclude-dir=\.svn --exclude=\*~"
Bingo, that's a perfect solution in my mind.