bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: grep should have option to skip FIFOs


From: Stephane Chazelas
Subject: Re: grep should have option to skip FIFOs
Date: Thu, 13 Jan 2005 10:33:52 +0000
User-agent: Mutt/1.5.6i

On Thu, Jan 13, 2005 at 11:05:57AM +0100, Stepan Kasal wrote:
> On Wed, Jan 12, 2005 at 02:19:19PM -0600, Gerd Knops wrote:
> > When using 'grep -r', grep 'hangs' when encountering a FIFO. Grep 
> > should probably skip those, or at least offer and option to skip them.
> 
> Indeed, the option -D --devices is designed for this.  Yet the
> implementation had a bug, which is has been fixed in current CVS version.
> 
> You can always use something like this:
> 
> find . -type f | xargs -r grep -H pattern
> 
> This way is much more flexible than the grep -r shortcut.
[...]

But bogus. find default output format (nl delimited list) is not
suitable for xargs input format (blank delimited list where
single double quotes and backslashes are used to escape the
delimiters).

As "-r" is GNU/BSD xargs specific, you might as well use -0:

find . -type f -print0 | xargs -r0 grep -H pattern

(note that the above skips symlinks to regular files).

-- 
Stéphane





reply via email to

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