Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

So I have a project under svn and I'm searching the file contents. In the result set I get .svn files that I don't want actually to see. for example:

$ grep -i -r "breadcrumb" . -l

how can I exclude the files under ".svn" directories from the result set so that I only get

share|improve this question
up vote 5 down vote accepted

Pipe those through:

grep -v '/\.svn/'
share|improve this answer
Works like a charm. But why '/\.svn/' and not ".svn"? – Jon Doe Nov 12 '10 at 4:05
You could simply use "svn"; it's not likely that you've used svn in your file names. – Nerdling Nov 12 '10 at 6:11
@Joe If you don't surround it by slashes or have the dot, it could match other things with "svn" in their path... And @Nerdling I don't see the value in not matching accurately when it's so easy, however unlikely. – Oli Nov 12 '10 at 10:04

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.