Grepping in your subversion working copies
Grepping is in a lot of cases a pain when your dealing with subversion directories..
I'm sure this doesn't cover all possible greps, but this at least works for the simple ones..
#!/bin/sh
grep $* | grep -v ".svn"
Call this script for example "svngrep", give it executable permissions (chmod +x svngrep) and place it in a directory thats in your PATH variable (/bin).
Now, use svngrep as you would normally use grep..
Update: The anonymous posters script is way better (the first comment)
Comments
Anonymous •
This is a little more robust:#!/bin/bash
find . -type d \( -name .svn -o -name ignore1 -o -name ignore2 \) -prune -o -type f -print0 |xargs -0r grep --color "$@"
Evert •
Great script!Martin Jansen •
ack automatically ignores .svn directories and is generally a neat litte tool:http://search.cpan.org/~petdance/ack/ack
ethan •
Sweet. Thanks.Matthew Purdon •
If you are on a box that you haven't set up that script on, I like to use the following straight from the command line:$ find . -name "*.php" | xargs grep "search string"
Not as nice as having the first comment script, but easy enough to remember without having to look it up.
Dagfinn Reiersøl •
There is also a script called wcgrep (http://svn.collab.net/repos/svn/trunk/contrib/client-side/wcgrep)Amanda •
Hi, all. Nice site...I really like your site ! Good job man.hBush •
Hello+people%21+Nice+site%21SVince •
Just wanted to say hellou