Date: Mon, 7 Mar 2005 17:40:04 GMT From: Chris Hodgins <chodgins@cis.strath.ac.uk> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/78504: grep --exclude does not check directories ? Message-ID: <200503071740.j27He40x092291@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/78504; it has been noted by GNATS.
From: Chris Hodgins <chodgins@cis.strath.ac.uk>
To: Charlie & <root@bang.freebsd.dk>
Cc: FreeBSD-gnats-submit@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@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@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
> To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"
>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200503071740.j27He40x092291>
