[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: egrep --exclude problem
From: |
Bob Proulx |
Subject: |
Re: egrep --exclude problem |
Date: |
Sat, 1 Sep 2007 02:42:45 -0600 |
User-agent: |
Mutt/1.5.9i |
Yakov Lerner wrote:
> I am doing
> egrep --exclude=.svn -r foo .
> but grep still prints matches under .svn subtree ?
> Why ? What I am doing wrong ?
The man page for grep says:
--exclude=PATTERN
Recurse in directories skip file matching PATTERN.
The exclude is documented to match only files and not directories.
Let me suggest using find instead. This is certainly more words but
it also works with any of the commands and so is worth it.
find . -name .svn -prune -o -type f -exec grep foo {} +
Alternatively you could use the shell to expand to files that are not
the .svn directory. The following is not standard (not POSIX) but
does work with bash and possibly other shells with extensions.
grep -r foo !(.svn)
You can see how this works with 'echo'.
echo grep -r foo !(.svn)
Bob
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: egrep --exclude problem,
Bob Proulx <=