bin/78504: grep --exclude does not check directories ?
Chris Hodgins
chodgins at cis.strath.ac.uk
Mon Mar 7 17:40:05 GMT 2005
The following reply was made to PR bin/78504; it has been noted by GNATS.
From: Chris Hodgins <chodgins at cis.strath.ac.uk>
To: Charlie & <root at bang.freebsd.dk>
Cc: FreeBSD-gnats-submit at freebsd.org
Subject: Re: bin/78504: grep --exclude does not check directories ?
Date: Mon, 07 Mar 2005 17:38:47 +0000
Charlie & wrote:
>>Number: 78504
>>Category: bin
>>Synopsis: grep --exclude does not check directories ?
>>Confidential: no
>>Severity: non-critical
>>Priority: medium
>>Responsible: freebsd-bugs
>>State: open
>>Quarter:
>>Keywords:
>>Date-Required:
>>Class: sw-bug
>>Submitter-Id: current-users
>>Arrival-Date: Sun Mar 06 18:00:07 GMT 2005
>>Closed-Date:
>>Last-Modified:
>>Originator: Charlie &
>>Release: FreeBSD 6.0-CURRENT i386
>>Organization:
>>Environment:
>
> System: FreeBSD bang.freebsd.dk 6.0-CURRENT FreeBSD 6.0-CURRENT #2: Tue Feb 15 14:21:39 CET 2005 root at bang.freebsd.dk:/bang/p4/phk/phk_bufwork/sys/i386/compile/BANG i386
>
> -current.
>
>
>>Description:
>
>
> # cat grep.sh
> #!/bin/sh
>
> mkdir __
> cd __
> mkdir aaa
> echo foo > a1
> echo foo > aaa/a1
>
> set -x
> grep -r --exclude=aaa foo .
> # sh -x grep.sh
> + grep -r --exclude=aaa foo .
> ./aaa/a1:foo
> ./a1:foo
>
> It doesn't seem possible to exclude directories when using
> the -r(ecursive) option.
>
The man page states that the exclude flag is for skipping files and not
directories.
--exclude=PATTERN
Recurse in directories skip file matching PATTERN.
You can do what you want with the find command.
find . \( -type d -name "aaa" -prune \) -o -print
Chris
>
>
>>How-To-Repeat:
>
> see above.
>
>>Fix:
>
>
>
>
>>Release-Note:
>>Audit-Trail:
>>Unformatted:
>
> _______________________________________________
> freebsd-bugs at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
> To unsubscribe, send any mail to "freebsd-bugs-unsubscribe at freebsd.org"
>
More information about the freebsd-bugs
mailing list