
How did people use ed? - marttt
https://retrocomputing.stackexchange.com/questions/5341/how-did-people-use-ed
======
pwdisswordfish2
I still use ed every day. Mostly non-interactive use, i.e., "ed scripts". Have
not found any "modern" editors that are as small, fast and robust, especially
for editing large files.

~~~
marttt
Plan9's sam (sam -d for command line use) is a great improvement over ed, by
the way.

Homepage: [http://sam.cat-v.org/](http://sam.cat-v.org/)

Paper by Rob Pike:
[http://doc.cat-v.org/plan_9/4th_edition/papers/sam/](http://doc.cat-v.org/plan_9/4th_edition/papers/sam/)

And another paper by Pike on sam's command language (at the core of which are
what he calls 'structural regular expressions'):
[http://doc.cat-v.org/bell_labs/sam_lang_tutorial/sam_tut.pdf](http://doc.cat-v.org/bell_labs/sam_lang_tutorial/sam_tut.pdf)

~~~
pwdisswordfish2
That requires a graphics layer. It expects the use of a mouse. With few
exceptions, I do not require a mouse nor a graphics layer. The only editor
that can beat ed for non-interactive editing is sed.

~~~
marttt
Sam also has a command line only mode, invoked with the '-d' switch ('sam -d
filename'). This is just like 'ed', no graphics layer or mouse needed. But the
command language is both simpler and more powerful IMO, especially the 'X'
command for editing multiple files at once.

~~~
pwdisswordfish2
Is it possible to run sam without loading a graphics layer? As far as I know
one cannot run Plan9 in "VGA text mode". If trying run sam on an OS other than
Plan9, does sam require a graphics layer, e.g., X11? Last I checked, it does.
If this has changed, I am interested.

~~~
marttt
Indeed, the Plan9 ecosystem itself (including its Linux port, plan9port) is
heavily built around GUI and a mouse.

Sam alone, however, can be compiled for command line only, without X11 support
under Linux. This has been done in the 9base package:

[https://git.suckless.org/9base/file/sam/Makefile.html](https://git.suckless.org/9base/file/sam/Makefile.html)

[https://tools.suckless.org/9base/](https://tools.suckless.org/9base/)

There is also an updated Linux version of Sam alone, without any other P9
tools. I suppose this should also be trivial to build without X11 support:

[https://github.com/deadpixi/sam/](https://github.com/deadpixi/sam/)

~~~
pwdisswordfish2
I will investigate this. Thank you for setting me straight.

The discussion of this GUI dependency came up years ago on HN and someone who
worked at Bell Labs now at Google basically said, in so many words, "sam
without the mouse is not sam".

~~~
marttt
Very interesting, I was not aware of this. I see what he/she meant, but I
would add "sam without the mouse is not sam, but it is still superior to ed in
many ways". :)

A link to that discussion would be great (if you manage to find it).

------
kaliszad
There is a book about Ed by Michael W Lucas. I guess, in the beginning it was
supposed to be a bit of a joke, but it became useful for connecting the dots
and is read for an afternoon:
[https://mwl.io/nonfiction/tools#ed](https://mwl.io/nonfiction/tools#ed)

~~~
marttt
Yes, I read it and liked it. The "joking" eventually gets tiresome, though.
Still a helpful book if one wants to grasp the basics of ed in 2020, though.

~~~
marttt
Just for the sake of it -- a great discussion about ed from 2012:

[https://news.ycombinator.com/item?id=4120513](https://news.ycombinator.com/item?id=4120513)

And a cheat sheet linked there:

[https://catonmat.net/ftp/ed.text.editor.cheat.sheet.pdf](https://catonmat.net/ftp/ed.text.editor.cheat.sheet.pdf)

------
jkells
I've recently been doing some hobby coding on a Commodore 128 and I'm getting
the hang of editing basic programs without being able to edit inline very
well.

I use the list command to dump out sections of the program until I find where
I want to edit and then add / edit lines whilst I can still see the listing at
the top of the screen.

------
redis_mlc
DBAs use ed, sed and related Unix utilities for removing create, drop and bad
events from multi-GB dump and binlogs.

Source: DBA.

------
flukas88
It’s ok for quick fixes. But it’s a different era of editing tbh

