DragonFly BSD
DragonFly submit List (threaded) for 2005-06
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: grep --dont-read-devices-or-symlinks


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 17 Jun 2005 08:39:05 -0700 (PDT)

: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 recurs=
:ive
:loops...
:
:cheers
:  simon

    Well, there is at least one issue with this.  I'm not sure the option is
    general enough.  e.g. perhaps it should not avoid symlinks.  I'd use
    stat() rather then lstat() at the very least.

    Grep isn't realliy the best utility to search an entire hierarchy.
    I would use a comnation of find with the -exec option to write
    a search script.  I use this:

#!/bin/csh
#

find . -type f -and -not -name '*.*o' -and -not -name '*.a' -and -not -name '*.kld' | fgrep -v ./compile | xargs egrep "$argv" | egrep -v 'Binary'




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