recursive grep: exclude specific directories

grep -r --exclude-dir=dev --exclude-dir=sys --exclude-dir=proc PATTERN data

Source: https://stackoverflow.com/questions/2799246/grep-excluding-a-specific-folder-using


You might look into ack.

I've just started using it but it seems well-suited for this.


you can use find instead:

find . -not -path "*/.svn*" -not -type d -exec grep -ni "myfunc" {} \; -print

OK, so that's a little backwards, you get the grep results first and then the path. Maybe someoe else has a better answer?