fgrep (isn't)

fnf at unisoft.UUCP fnf at unisoft.UUCP
Wed Jul 24 03:50:36 AEST 1985


In article <5785 at utzoo.UUCP> henry at 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
===========================================================================



More information about the Comp.unix mailing list