bug-grep
[Top][All Lists]
Advanced

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

Re: avoiding non-plain files with -I [bug-grep]


From: Charles Levert
Subject: Re: avoiding non-plain files with -I [bug-grep]
Date: Sun, 1 May 2005 12:41:28 -0400
User-agent: Mutt/1.4.1i

* On Sunday 2005-05-01 at 19:03:59 +0300, Jacob Lerner wrote:
> 
> Is it possible to have grep ignore p(FIFO) and devices(b,c) without trying
> to open them ? Is there such a switch ? DOes grep do it with -I switch ?

According to `grep --help`:

  -D, --devices=ACTION      how to handle devices, FIFOs and sockets
                            ACTION is 'read' or 'skip'


> My workaround is ugly, I do something like 'find /etc -type f | grep+ regex'
> where grep+ is a script which reads filenames from stdin and greps them.
> This is slow, though, but does avoid being stuck on non-plainfiles.

A custom script is not needed:

  find /etc -type f -print0 | xargs -0r grep -H [OTHER OPTIONS] PATTERN

where

  -H, --with-filename       print the filename for each match




reply via email to

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