Xref: utzoo comp.unix.questions:26446 comp.unix.shell:698 Path: utzoo!utgpu!watserv1!watmath!att!att!pacbell.com!ucsd!sdd.hp.com!wuarchive!cs.utexas.edu!uunet!crdgw1!sixhub!davidsen From: davidsen@sixhub.UUCP (Wm E. Davidsen Jr) Newsgroups: comp.unix.questions,comp.unix.shell Subject: Re: grep Message-ID: <2160@sixhub.UUCP> Date: 24 Oct 90 02:44:23 GMT References: <1990Oct23.123025.18012@kodak.kodak.com> Reply-To: davidsen@sixhub.UUCP (bill davidsen) Followup-To: comp.unix.questions Organization: *IX Public Access UNIX, Schenectady NY Lines: 21 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@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