Skip grep, use awk
While awk is indeed under-appreciated, there are many instances where using grep to pre-filter your input is helpful because the grep family (GNU grep, agrep, etc.) can match strings much much faster than awk&#x27;s regex engine.<p>For example:  GNU grep uses a heavily optimized implementation of the Boyer-Moore string search algorithm [1] which (it is claimed) requires just 3 (x86) cycles per byte of input.  Boyer-Moore only searches for literal strings, but grep will extract the longest literal from the search regex (e.g. the string &quot;foo&quot; from the regex &#x2F;foo(bar|baz)+&#x2F;) and use Boyer-Moore to find candidate matches that are then verified using the regex engine.<p>So if you have a large corpus of text to search, grep is your friend.  It can easily saturate your I&#x2F;O bandwidth and perform an order of magnitude faster than typical &quot;big data&quot; platforms. [2]<p>[1] <a href="https:&#x2F;&#x2F;lists.freebsd.org&#x2F;pipermail&#x2F;freebsd-current&#x2F;2010-August&#x2F;019310.html" rel="nofollow">https:&#x2F;&#x2F;lists.freebsd.org&#x2F;pipermail&#x2F;freebsd-current&#x2F;2010-Aug...</a><p>[2] <a href="https:&#x2F;&#x2F;aadrake.com&#x2F;command-line-tools-can-be-235x-faster-than-your-hadoop-cluster.html" rel="nofollow">https:&#x2F;&#x2F;aadrake.com&#x2F;command-line-tools-can-be-235x-faster-th...</a>