Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/17/84 chuqui version 1.9 3/12/85; site unisoft.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!lll-crg!dual!unisoft!fnf From: fnf@unisoft.UUCP Newsgroups: net.unix Subject: Re: fgrep (isn't) Message-ID: <507@unisoft.UUCP> Date: Tue, 23-Jul-85 13:50:36 EDT Article-I.D.: unisoft.507 Posted: Tue Jul 23 13:50:36 1985 Date-Received: Thu, 25-Jul-85 21:43:04 EDT References: <495@unisoft.UUCP> <5785@utzoo.UUCP> Reply-To: fnf@unisoft.UUCP (Fred Fish) Organization: UniSoft Systems, Berkeley Lines: 41 In article <5785@utzoo.UUCP> henry@utzoo.UUCP (Henry Spencer) writes: >> Notice that plain old grep is the fastest of all, and fgrep is the slowest! > >You forgot to test egrep, which is well-known to be the fastest for the ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ >trivial case. Where fgrep makes a difference is when you want to search >for a number of strings simultaneously. Grep can't do that at all, and >egrep hits pattern-complexity limits quickly. Fgrep really screams along >in this case... Thanks for the tidbit of Unix folklore Henry. But no, I didn't forget to test egrep, here is an extract from my original posting: real user sys ---- ---- --- grep 1.9 1.1 0.6 bgrep 2.7 1.9 0.7 egrep 3.5 2.6 0.7 fgrep 9.6 8.8 0.7 It would be nice if the documentation wasn't so misleading. From the From the system V User's Manual grep(1): "Grep patterns are limited regular *expressions* in the style of ed(1)..." "Egrep patterns are full regular *expressions*..." "Fgrep patterns are fixed *strings*; it is fast and compact." This implies that fgrep should be the fastest for plain old strings even if there is only one (or none? :-). -Fred =========================================================================== Fred Fish UniSoft Systems Inc, 739 Allston Way, Berkeley, CA 94710 USA {ucbvax,decvax}!unisoft!fnf (415) 644 1230 TWX 11 910 366-2145 ===========================================================================