Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Grep
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==History== Before it was named, grep was a private utility written by [[Ken Thompson]] to search files for certain patterns. [[Doug McIlroy]], unaware of its existence, asked Thompson to write such a program. 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"). The next day he presented the program to McIlroy, who said it was exactly what he wanted. Thompson's account may explain the belief that grep was written overnight.<ref>{{cite AV media|url=https://www.youtube.com/watch?v=EY6q5dv_B-o |archive-url=https://ghostarchive.org/varchive/youtube/20211211/EY6q5dv_B-o| archive-date=2021-12-11 |url-status=live|title=VCF East 2019 -- Brian Kernighan interviews Ken Thompson|publication-date=6 May 2019|publisher=YouTube|type=video}}{{cbignore}} (35 mins)</ref> Thompson wrote the first version in [[PDP-11]] [[assembly language]] to help [[Lee E. McMahon]] analyze the text of ''[[The Federalist Papers]]'' to determine authorship of the individual papers.<ref>Computerphile, ''[https://www.youtube.com/watch?v=NTfOnGZUZDk Where GREP Came From]'', interview with [[Brian Kernighan]]</ref> The [[ed (text editor)|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.<ref name=history102 /> He chose the name because in ed, the command <code>g/re/p</code> would print all lines featuring a specified pattern match.<ref>{{cite web|url=http://perl.plover.com/classes/HoldSpace/samples/slide012.html|title=ed regexes|website=perl.plover.com|access-date=24 April 2018|url-status=dead|archive-url=https://web.archive.org/web/20171020031534/https://perl.plover.com/classes/HoldSpace/samples/slide012.html|archive-date=20 October 2017}}</ref><ref>{{cite web|url=http://robots.thoughtbot.com/how-grep-got-its-name|title=How Grep Got its Name|website=robots.thoughtbot.com|access-date=24 April 2018|url-status=dead|archive-url=https://web.archive.org/web/20170809155158/https://robots.thoughtbot.com/how-grep-got-its-name|archive-date=9 August 2017}}</ref> grep was first included in [[Version 4 Unix]]. Stating that it is "generally cited as ''the'' prototypical software tool", McIlroy credited grep with "irrevocably ingraining" Thompson's [[tools philosophy]] in Unix.<ref name="reader">{{cite tech report |first1=M. D. |last1=McIlroy |author-link1=Doug McIlroy |year=1987 |url=http://www.cs.dartmouth.edu/~doug/reader.pdf |title=A Research Unix reader: annotated excerpts from the Programmer's Manual, 1971β1986 |series=CSTR |number=139 |institution=Bell Labs |url-status=live |archive-url=https://web.archive.org/web/20171111151817/http://www.cs.dartmouth.edu/~doug/reader.pdf |archive-date=2017-11-11 }}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)