Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using grep to filter out directories I am not interested in like this:

svn stat | grep -v data/charts | grep -v lib/model | grep -v web/pics

It seems a bit "hacky". Is there a better way to specify more than one string to ignore, so that I dont have to chain multiple grep commands?

share|improve this question
up vote 2 down vote accepted

You can do svn stat | grep -vE 'data/charts|lib/model|web/pics'

You may also be interested in looking at grep -x. ack might be another tool of interest to you.

share|improve this answer
This is the command that works for me – morpheous Jul 29 '10 at 19:29

You can use disjuction with grep. Its the pipe symbol like in many regexes but you have to escape it since bash interprets it as actual pipe. Try this:

svn stat | grep -v data/charts\|lib/model\|web/pics
share|improve this answer

Or use grep -f, and put the list of patterns into a file. (That's most convenient if the list of things is fairly constant, of course.) grep -vf works fine, and inverts the sense of the matching just like regular grep -v. Just make sure you don't have any blank lines in the file full of patterns, because they'll match everything!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.