WorkHabit Blogs

WORKHABIT LABS

Grepping through repo directories (aka the ".svn/" problem)

by Domenic Santangelo Published: November 3rd, 2008
Tagged: bash, development, grep, svn

It’s super annoying when you’re looking for a string in your code, so you do a recursive grep, only to get a ton of matches within svn’s “.svn” directories.

Here’s a solution:

Inside your ~/.bash_profile, insert this line:

alias rgrep="find . -follow ( -name ".svn" ) -prune -o -print | xargs grep -Hn"

Save it, then log out and back in.

Now instead of grep -ir "sprintf" *, do rgrep sprintf. Cake!

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <h3>
  • You can use Markdown syntax to format and style the text.

More information about formatting options

Papernote
Papernote

Upcoming Events

WorkHabit Labs Archives