* 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