[nycbug-talk] Some history of Unix utilities

Isaac (.ike) Levy ike at blackskyresearch.net
Tue Aug 6 00:25:09 EDT 2013

On Aug 5, 2013, at 6:46 PM, James E Keenan <jkeen at verizon.net> wrote:

> nycbug-talk is one of the few lists I subscribe to where I know people take an interest in Unix history.  This discussion of the origins of several Unix utilities popped up on the Perl 5 Porters newsgroup today.  The participants are usually among the most well informed on p5p, so I figured I'd share it.
> Thank you very much.
> Jim Keenan

Jim,  I never thought I'd say anything like this, but, thanks for sharing this cross-post.

Possibly the first truly delightful cross posts I'm seen on talk@!


> -------- Original Message --------
> Subject: Re: [perl #119095] Empty regular expression does not match in some cases
> Date: Mon, 5 Aug 2013 19:09:18 +0100
> From: arc at cpan.org (Aaron Crane)
> To: Aristotle Pagaltzis <pagaltzis at gmx.de>
> CC: Perl5 Porters <perl5-porters at perl.org>
> Newsgroups: perl.perl5.porters
> Aristotle Pagaltzis <pagaltzis at gmx.de> wrote:
>> A lot of the syntax and idioms lore that we think of as “regexps”, at
>> least in a Unix-y tradition, is really the regexp vernacular of ed. The
>> entire grep utility is an extraction of an ed idiom as a stand-alone
>> program.
>> And even when I say all this, I am almost certainly being ahistorical –
>> I do not know in detail the lineage and history of ed and all its next
>> of kin (ex/vi, grep, sed, patch etc) and would actually be surprised if
>> the story weren’t more intertwined and complex than my portrayal, even
>> WRT just this one aspect.
>> (I expect Aaron to come up behind me and embarrass me now. :-) )
> Nope, your summary pretty much covers it. :-)
> ed(1) already exists in the First Edition manual (so before November
> 1971), but neither sed(1) nor grep(1) do:
> http://cm.bell-labs.com/cm/cs/who/dmr/man12.pdf
> http://cm.bell-labs.com/cm/cs/who/dmr/man13.pdf
> grep(1) came next, in Fourth Edition (so between February and November 1973):
> http://www.tuhs.org/Archive/PDP-11/Distributions/research/Dennis_v4/v4man.tar.gz
> In 1975, George Coulouris at Queen Mary College (in London;
> subsequently renamed Queen Mary and Westfield, and then Queen Mary,
> University of London) wrote em ("editor for mortals"), an interactive
> ed(1)-like editor for cursor-addressed displays.  When he visited
> Berkeley in 1976, he took it with him, and a certain Bill Joy took it
> and morphed it into ex(1), which shipped in 1BSD (March 1978):
> http://www.eecs.qmul.ac.uk/~gc/history/
> vi(1) was originally (in 2BSD, May 1979) a hard link to ex(1); when it
> was launched under that name, it would start in visual mode rather
> than normal mode, but ex(1) had all the same abilities.
> sed(1) didn't appear till Seventh Edition, in January 1979:
> http://plan9.bell-labs.com/7thEdMan/v7vol1.pdf
> The original diff(1) appeared in Fifth Edition (June 1974), and
> originally generated only "edit scripts" (à la modern `diff -e`) that
> could be passed to ed(1):
> http://www.tuhs.org/Archive/PDP-11/Distributions/research/Dennis_v5/v5man.pdf
> As for patch(1), Larry first wrote it in 1984, and published it in
> 1985; it already handled context and unified diffs at that point, as
> well as the traditional edit scripts:
> https://groups.google.com/forum/#!topic/mod.sources/xSQM63e39YY
> Now, Ken Thompson wrote the Unix ed(1) in PDP-11 assembler:
> https://code.google.com/p/unix-jun72/source/browse/trunk/src/cmd/ed2.s
> https://code.google.com/p/unix-jun72/source/browse/trunk/src/cmd/ed3.s
> This means it can be dated to some time in 1971, according to Dennis Ritchie:
> http://cm.bell-labs.com/who/dmr/hist.html
> But it turns out we can rewind a little further.  A team at UCB
> (including L. Peter Deutsch) wrote an editor called qed in 1968:
> http://web.archive.org/web/20120219114658/http://www.computer-refuge.org/bitsavers/pdf/sds/ucbProjectGenie/mcjones/R-15_QED.pdf
> It's still possible to see the core of the ed(1) design in that, even
> though the details differ quite a lot; for example, the 1968 qed
> doesn't have regexes at all.
> Ken Thompson ported qed to CTSS circa 1970, and therefore shortly
> *before* he wrote ed(1); the manual for his port can be found here:
> http://cm.bell-labs.com/cm/cs/who/dmr/qedman.pdf
> This is much more similar to the ed(1) we know and (presumably) love,
> including regexes strictly more powerful than those in traditional
> ed(1), and slashes to delimit them (where the 1968 qed used square
> brackets for its search strings).  And we find that the manual says
> "The null regular expression standing alone is equivalent to the last
> regular expression encountered."
> So this aspect of Perl can be dated back to code written no later than
> 1970, for a text editor running on an operating system that I suspect
> noone subscribed to this list has ever used.
> Enjoy!
> -- 
> Aaron Crane ** http://aaroncrane.co.uk/
> _______________________________________________
> talk mailing list
> talk at lists.nycbug.org
> http://lists.nycbug.org/mailman/listinfo/talk

More information about the talk mailing list