grep

Wm E. Davidsen Jr davidsen at sixhub.UUCP
Wed Oct 24 12:44:23 AEST 1990


Lots of people have given you ideas on this, I'll just add that if you
have a large number of non-text files in this structure, you can save
time by using the "file" command to identify the text files.

Something like:

    $ find . -type f -print | xargs file | grep " text" |
    > sed 's/:.*$//' | xargs grep PATTERN /dev/null

  While this looks like a lot of stuff, it will be vastly faster than
searching all the non-text files and getting possible bizarre matches on
binary code or other strings. I invented this when desparate enough to
look for a string in /usr.

Note: I cross posted this item *only* to the shell group, followups by
default to the original group.
-- 
bill davidsen - davidsen at sixhub.uucp (uunet!crdgw1!sixhub!davidsen)
    sysop *IX BBS and Public Access UNIX
    moderator of comp.binaries.ibm.pc and 80386 mailing list
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.unix.questions mailing list