Ignore svn directories while you grep

I have seen a lot of posts that show you how to ignore svn files when you grep. However, there seems to be more demand for a script that ignores svn directories. Here is one option:

tgrep(){
     grep -r $1 * | grep -v .svn | while read line;
     do
          echo $line
     done
}

Just add the function to one of your bash config files (~/.bashrc, ~/.bash_profile, ~/.bash_login), restart your terminal, and you are good to go. Here is a great article about how bash configs work. I put tgrep() in my .bashrc file, but also added the following to .bash_profile to force my .bashrc to load.

. ~/.bashrc
No TweetBacks yet. (Be the first to Tweet this post)
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • MySpace
  • Slashdot
  • StumbleUpon
  • Technorati
  • TwitThis

If you enjoyed this post, make sure you subscribe to my RSS feed!

This entry was posted in Software and tagged , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">