[TUHS] Short history of 'grep'

John Cowan cowan at mercury.ccil.org
Mon Feb 1 03:38:46 AEST 2016

Mary Ann Horton scripsit:

> When I tell this story to nontechical folks, I prefix it with the
> brief note that fgrep ought to be fastest, because it's simple, and
> egrep ought to be slowest, because it's complex, but in reality
> fgrep is slowest and egrep is fastest.  

Is it really?  The one time I used fgrep in production, I was checking
a a few hundred documents at a time to see which ones contained any of a
few thousand keywords.  "fgrep -l -f keywords" seemed to do the job quite
quickly: would it really have been faster to assemble the keywords into
a single egrep regex and use egrep?  (This was on Solaris, so using more
or less classic fgrep, not GNU grep.) For a while I referred to myself as
"just another desperate fgrep hacker".

I use "ex" as my normal text editor (including for this email); I drop
into vi mode occasionally, mostly to bounce on the % key when writing
Lisp.  Because there is no support for | in ex regexes, I rely on the
low entropy of English text (about 2.7 bits per letter) and search
for e.g. "open|shut" by searching for "[os][ph][eu][nt]".  I may
get a few false positives, but they will easily be removed by vgrep.

John Cowan          http://www.ccil.org/~cowan        cowan at ccil.org
After fixing the Y2K bug in an application:
        WELCOME TO <censored>
        DATE: MONDAK, JANUARK 1, 1900

More information about the TUHS mailing list