To be honest, I’ve never used ed often either. However, I did find at least one scenario where I did use it. Here are two examples: one when I was ready to use something else and another admittedly rare case when I actually found it to be useful.
First the “wish I had something else case”. I was new to Unix and I was at a Bell Systems training facility, getting to know Unix. In a lab, all I knew was ed, but I wasn’t very good with it and it’s not all that easy to see what’s on your screen. Fortunately someone showed me vi; though vi isn’t necessarily “easy” in every possible way, I learned just enough keystrokes to get the labs done much easier than with ed.
Okay, so we’ve established that ed is not the most intuitive tool or the most powerful editor, so when might I actually find a use for it? Well, there are other tools to do what I actually got a use, but sometimes they are either not available or they’re difficult to master; that’s where ed turned out to be fine.
I wanted to simply get in and substitute one value for another across a document. Vi may have worked, Perl, sed, awk, or gawk would arguably do a more complete job, but sed can be tricky since the default is stdin and stdout, Perl, awk and gawk are more complicated, but ed has a limited, straightforward command set, so it turned out to be a quick, easy solution.
Could I have used something else, including vi or Emacs? Probably, but doing it with ed was fast, quick and the job was done within a minute or two, so I felt that made it a useful tool for that specific case; can’t honestly say I’ve needed to do that very often, but it sure did come in handy that one time when I had an unusual brain freeze on other approaches!
One other rare scenario is when a system is crippled and a lot of features do not work; most of the time vi is still available, but it’s possible that ed, as a standard utility, may be one of the last things to go. I’ve got a lot of other editors in my arsenal and I hadn’t touched ed in years, but I did try a few things and in the limited capacity of a “line editor” rather than a “screen editor”, it is useful for rare scenarios where a line by line tool is what’s called for. That’d probably be on some ancient 20-40 year old hardware; I have a few friends that actually relish working with these; that ancient stuff might present a few of those rarely seen use cases, other than that, yeah, this is more of a historical thing than a practical every day tool in use today.
The guy I enjoy the most, “Distro Tube”, decided to rank 14 text editing tools, a few of them are IDE (Integrated Development Environments) that include editing, some are just plain text editors.
The Text Editor Tier List (Open Source Editors ONLY!)
Just so you know, DT ranked Atom, Ed, and Gvim as YUCK, though he did rate Emacs, Neovim and Vim as GREAT. This is my update for Tuesday, June 16m since I’ve tacked onto this note a couple of times now!