[TUHS] Regular Expressions

Dave Horsfall dave at horsfall.org
Mon Aug 10 09:44:11 AEST 2020


On Sat, 1 Aug 2020, Doug McIlroy wrote:

> This lesson came home with a vengeance when Al Aho wrote egrep, which 
> implemented full regular expressions as DFA's. I happened to be writing 
> calendar(1) at the same time, and used egrep to search calendar files 
> for dates in rather free formats for today and all days through the next 
> working day.  [...]

I heard somewhere (a Usenix paper?) that "egrep" turned out to be faster 
than "fgrep" (designed to look for fixed strings only), thus "egrep" is 
now symlinked everywhere.

On my FreeBSD box (in /usr/bin):

     aneurin% ls -li *grep
     25471 -r-xr-xr-x  7 root  wheel  40744 Oct 15  2017 bsdgrep
     25480 -r-xr-xr-x  9 root  wheel  82136 Oct 15  2017 bzegrep
     25480 -r-xr-xr-x  9 root  wheel  82136 Oct 15  2017 bzfgrep
     25480 -r-xr-xr-x  9 root  wheel  82136 Oct 15  2017 bzgrep
     25480 -r-xr-xr-x  9 root  wheel  82136 Oct 15  2017 egrep
     25480 -r-xr-xr-x  9 root  wheel  82136 Oct 15  2017 fgrep
     25480 -r-xr-xr-x  9 root  wheel  82136 Oct 15  2017 grep
     25471 -r-xr-xr-x  7 root  wheel  40744 Oct 15  2017 lzegrep
     25471 -r-xr-xr-x  7 root  wheel  40744 Oct 15  2017 lzfgrep
     25471 -r-xr-xr-x  7 root  wheel  40744 Oct 15  2017 lzgrep
     23554 lrwxr-xr-x  1 root  wheel     10 Feb 18  2011 pgrep -> /bin/pgrep
     25471 -r-xr-xr-x  7 root  wheel  40744 Oct 15  2017 xzegrep
     25471 -r-xr-xr-x  7 root  wheel  40744 Oct 15  2017 xzfgrep
     25471 -r-xr-xr-x  7 root  wheel  40744 Oct 15  2017 xzgrep
     25480 -r-xr-xr-x  9 root  wheel  82136 Oct 15  2017 zegrep
     25480 -r-xr-xr-x  9 root  wheel  82136 Oct 15  2017 zfgrep
     25480 -r-xr-xr-x  9 root  wheel  82136 Oct 15  2017 zgrep

OK, there's a few strays in there...

-- Dave


More information about the TUHS mailing list