bug-grep
[Top][All Lists]
Advanced

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

Re: please allow a list of files to grep, as a file that can be - for st


From: Benno Schulenberg
Subject: Re: please allow a list of files to grep, as a file that can be - for stdin (fixes other bugs)
Date: Sat, 10 Jun 2006 13:29:17 +0200
User-agent: KMail/1.9.3

Santiago José Ruano Rincón fowarded:
> Package: grep
> Version: 2.5.1.ds2-5
> Severity: wishlist
>
> this partly fixes other bugs, including part of the bug that i
> just filed on symlink recursion

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=368924

(Please provide hyperlinks; it makes looking things up much easier.)

> and these: 
>
>  Outstanding bugs -- Minor bugs; Unclassified (7 bugs): 1 report
>   1) #297154: grep: Please warn requesting recursion of stdin

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=297154

Nah.  Should it then also warn when doing 'grep -r pattern file'?

> 2) #177180: a "one filesystem" recursion option would be nice

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=177180

That would indeed be cool.  Have a patch?  :)

> 3) #283094: Option to ignore certain directories (e.g., 
> .svn) while recursing

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=283094

This is bug #11017 for grep on Savannah:
https://savannah.gnu.org/bugs/?func=detailitem&item_id=11017
It was a reaction to patch #3521:
https://savannah.gnu.org/patch/?func=detailitem&item_id=3521

In my opinion, though, --exclude should not exclude directories.

> grep should have an option that takes a list of files to grep. 
> it should allow - for stdin so that you can do this:
>
>       find ... -xdev |
>               grep -v .svn/ |
>               grep -r --files-input - apple

What's the -r doing in there?

> you might think that xargs can achieve the same effect, but that
> is incorrect.  consider:
>
>       find ... -xdev |
>               grep -v .svn/ |
>               xargs ... grep apple

It works fine here:

$ type sgrep
sgrep is aliased to `find -L . -type d -name .svn -prune -o -type 
f -print0 | xargs -0 grep'

$ sgrep apple
./doc/texinfo/nano.texi:the internal spell checker such that the 
words 'apple' and 'Apple' will
./ spa ces :the internal spell checker such that the words 'apple' 
and 'Apple' will

$ grep -r apple .
./doc/texinfo/nano.texi:the internal spell checker such that the 
words 'apple' and 'Apple' will
./.svn/texinfo/nano.texi:the internal spell checker such that the 
words 'apple' and 'Apple' will
./ spa ces :the internal spell checker such that the words 'apple' 
and 'Apple' will

> with the proposed option grep handles -h and -H properly.  with
> the xargs solution there is no way to print the filenames.

Huh?  Please give an actual example.

Benno





reply via email to

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