I'm showing my age but one of my early compsci courses the only editor available on the lab systems (at least the only editor we had access to) was ed.
After 4 months, I went on a co-op term and vi was VERY nice to use if you had 4 months of intense training in regular expressions and substitution patterns using ed.
Found this surprising having used arch for years. Turns out ed is not in GNU coreutils, which is part of the base package. But there's a posix package which includes ed and other posix stuff.
It is very frustrating. In my personal sh library, I probe for `ed` and, if not available, I alias to `ex -s`; I then write in-place editing scripts carefully to use only common functionality to both. Sigh.
That is very strange; ex should be part of Arch base... oh well, probe for `vi -s` and if this does not work either, get karma on reddit or whatever by making fun of Arch :D
Now that I look at it, base package is missing [0] a bit of stuff:
> The base package does not include all tools from the live installation, so installing other packages may be necessary for a fully functional base system. In particular, consider installing:
> - userspace utilities for the management of file systems that will be used on the system,
> - utilities for accessing RAID or LVM partitions,
> - specific firmware for other devices not included in linux-firmware (e.g. sof-firmware for sound cards),
> - software necessary for networking (e.g. a network manager or DHCP client),
> - a text editor,
> - packages for accessing documentation in man and info pages: man-db, man-pages and texinfo.
Most Linux distros don't claim to be POSIX compliant. (In fact, software on GNU/Linux in general doesn't claim to be such. Sometimes it's taken as a guideline, more often ignored entirely.)
This only focuses on using ed interactively. IMHO, ed's greatest utility is in scripts. For example, I still use "diff -e" as I find for small patches, it is more concise and no less readable. YMMV. I also like ed for non-interactively editing large files.
sed is most preferred, but IME there are some simple tasks that are not possible (or exceedingly difficult) with sed but possible with ed.
For example, moving lines and joining lines are obvious ones. Another is using line address "0", namely, with the "r" command.
Both sed and ed allow reading in a file after line 1 but AFAIK only ed allows inserting before line 1, at "line 0". According to the ed changelog, in 2006, the source was changed so that the "i" and "c" commands treat address 0 as address 1.
For example, a common task for me is to insert the contents of file #1 at the top of file #2.
AFAIK, this is impossible using sed's "r" command, but it's possible using ed's "r" command.
This distinguishes it from TECO, which is a character editor.
I find command line character editors hard to use. It's very easy to lose your place, and the cognitive load is just too high for me.
Now, mind, I never used one in anger for any real length of time. But the learning curve was off putting enough to make me seek greener pastures instead.
Like ed.
I used ed for a bit. I was using it to type in the ed clone from the Software Tools book, trying to get it to work in Turbo Pascal on CP/M (with the hope that I could get and ed to work on CP/M, because CP/Ms ed is awful).
It was quite useable and manageable. I had some rough parts, which I can't recall, but it wasn't a horrific experience to be sure.
The game changer for me was the detailed mode ("H"), which makes ed a lot more pleasant to use. I wish it could be passed on the command line as an option and aliased in the shell... maybe I should patch it.
I've started to find ed surprisingly fun to use for quick edits, I'm not leaving nvi yet but it has this nice "ancient Unix" vibe.
Still use ed commands but mostly in vi command line mode.
For me the most useful feature is the ability it has to remember the contents of regular expression matches inside \( ... \) and when you combine this with the g global edit command you can do complex manipulations in a similar way on every line in a file with a single ed line.
So
g/\(regex1\)whatever\(regex2\)/s//\2something\1/
switches whatever text matches regex1 and whatever matches regex2 and changes the intermediate text also.
It's a lot to type but quite easy once you have done it a few times to write a single edit that transforms your file exactly the way you want in one go or nearly so.
However dealing with columnar data it's probably better to use something like awk.
Last time I used ed was to change the network config of a Linux instance in an S/390 LPAR, mostly because I was the only one with any experience with it (an ed clone from back in my CP/M days). Not that I didn't have to scour 1999's Internet for a decent cheat sheet. The mainframe guys were impressed, but I only started breathing when the LPAR came back up and we were able to get a telnet connection.
> 11 Jul 91 - When I log into my Xenix system with my 110 baud teletype, both vi and Emacs are just too damn slow. They print useless messages like, ‘C-h for help’ and ‘“foo” File is read only’. So I use the editor that doesn't waste my VALUABLE time.
This is actually true if you ask ChatGPT to simulate a Unix session, and try editing text files. You literally can't use a visual editor.
Back in the day, the only in-game editor for MudOS was an ed like editor. I spent many hours on that. It was a factor in deciding to learn vim over emacs at the time.
we once had a little Ed script called "Offending" which would accept the ssh connection failure line
Offending key ...
and edit the failing key out of the known_hosts file.
extremely useful with bazillions of fresh virtual guests with well known static IP. you simply cut and paste the "Offending key" line into the shell and the ed script does it's magic.
After 4 months, I went on a co-op term and vi was VERY nice to use if you had 4 months of intense training in regular expressions and substitution patterns using ed.