grep is a command-line utility for searching plaintext datasets for lines that match a regular expression.
[5] Before it was named, grep was a private utility written by Ken Thompson to search files for certain patterns.
Responding that he would think about such a utility overnight, Thompson actually corrected bugs and made improvements for about an hour on his own program called "s" (short for "search").
[7] The ed text editor (also authored by Thompson) had regular expression support but could not be used to search through such a large amount of text, as it loaded the entire file into memory to enable random access editing, so Thompson excerpted that regexp code into a standalone tool which would instead process arbitrarily long files sequentially without buffering too much into memory.
[14] Other commands contain the word "grep" to indicate they are search tools, typically ones that rely on regular expression matches.
[15] In the Perl programming language, grep is a built-in function that finds elements in a list that satisfy a certain property.
The command flag -B means "best": In December 2003, the Oxford English Dictionary Online added "grep" as both a noun and a verb.