|grep||Many of the newer, public domain greps such as and GNU egrep, use the much faster Boyer-Moore search algorithm. Both agrep and GNU egrep are on the CD-ROM. |
 The GNU egrep executable is also installed under the name grep-so don't get confused!
In article 27.6, we used the to compare the execution times of fgrep, egrep, and grep. This time we'll use runtime to show the average time needed to search for the string Waldo in a large directory of files. First, let's show the results using agrep:
runtime -10 agrep Waldo *... AVERAGES: 0.48u 0.73s 0:01 0+261k 0+0io 0pf+0w
Here's the same output for GNU egrep:
runtime -10 egrep Waldo *... AVERAGES: 0.62u 0.62s 0:01 0+242k 0+0io 0pf+0w
Now compare these numbers against those in article 27.6. For example, here's what we get from the much-maligned everyday grep:
runtime -10 grep Waldo *... AVERAGES: 4.13u 0.83s 0:04 0+203k 21+0io 19pf+0w
grep took four clock seconds to search all the files, while both agrep and GNU egrep breezed by in one. So are you a believer yet?