The Strange Roots

Grep 🍇

Grep, the Unix command-line utility for searching plain text, is short for 'global regular expression print', the commands used to search files on the original ed text editor programm written by Unix designer Ken Thompson.

To search lines in ed you had to type g for 'global', re for 'regular expression' and p for 'print' or g/re/p in full. When Thompson was asked how to search a file that was too large for the editor, he wrote a new program and called it grep.

Douglas McIlroy, who also worked on Unix, said: "Grep, generally cited as the prototypical software tool, was born when Ken Thompson was asked how to search for patterns in a file that was too big for the editor. Thompson promptly liberated his regular expression recognizer and christened it after the ed command g/re/p. It was an instant hit and soon entered our language as a verb."

Root: The word `grep` is an acronym for global, regular expression and print.

Sources: Brian Kernighan remembers the origin of 'grep' | A Unix Research Reader: Annotated Excerpts from the Programmer’s Manual, 1971-1986