grep --dont-read-devices-or-symlinks

Andreas Hauser andy at
Tue Jun 28 07:39:03 PDT 2005

corecode wrote @ Fri, 17 Jun 2005 11:33:08 +0200:
> hey.
> find attached a patch to grep to only read real files, ignoring symlinks,
> devices, etc.(-O --only-files). I felt I need this for grepping my /src/sys
> which also contains some compile/* directories where modules produce recursive
> loops...

Reminds me i did an alternative implementation of grep.

It's not completly compliant to SUS but close enough.
I think the open options are all marked XXX.
It uses our regex lib.
The OR case is a bit slow though (foo|bar|baz).
I think that should be fixed in our regex lib.
But it's up to gnu grep in simple standard cases.
Was thinking of optimizing it a bit but ran out of time.

I also came to the conclusion that -r should be replace by find ;-)
It's not a SUSv3 option btw.


More information about the Submit mailing list