Better grep

firebus's picture

So, this is maybe the dumbest thing ever, but since I've been working a lot lately with a large codebase that's new to me and has many odd dependencies I do this a lot:

grep -lr someFunctionName someRepositoryWorkingCopy/

And for every interesting hit, I get about 5 hits from inside a .svn directory which makes it hard to see anything.

So then I have to go back and say

grep -lr someFunctionName someRepositoryWorkingCopy/ | grep -v svn

Which is annoying, and grep has no global ignore configuration, so why not write a small wrapper for grep and stick it somewhere that's earlier in your $PATH than /bin?

The first version called 'grep' instead of '/bin/grep' and it worked great until I changed my $PATH, at which point all the memory on my workstation was used up by infinitely looping forks! That was fun.

Powered by Drupal - Design by Artinet - Amazon Affiliate