[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: egrep --exclude problem

From: Tony Abou-Assaleh
Subject: Re: egrep --exclude problem
Date: Tue, 9 Oct 2007 01:26:23 -0300 (ADT)

The latest release, grep-2.5.3, introduced the long awaited option:

    directories that match PATTERN will be skipped.

You can get grep-2.5.3 from:




Tony Abou-Assaleh
Email:    address@hidden
Web site: http://tony.abou-assaleh.net
----------------------[THE END]----------------------

On Sat, 1 Sep 2007, Bob Proulx wrote:

> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]