Ah, ed. Back in the mid 80s, I had to teach a course on Unix & its tools - if I remember correctly it was called "Unix - a modern OS". One of those tools was of course ed. We couldn't use vi because the termcap/terminfo settings were screwed up for the physical serial terminals we had - I eventually fixed this & felt very pleased with myself, as those terminal config files are a b*tch.
Still, teaching bash, C and the usual suspects along with ed was very strenuous for the students, and for me - we only ran the course once.
I don't use ed interactively but find it's really useful in shell scripts that need to edit files - heredocs or piping printf output (like one example in the article; never felt a need for something like his xed). Even used it in a C program via popen() to edit settings in a config file.
ed is underrated.
(I'm responsible for suggesting GNU ed accept posix EREs; think I got the idea from NetBSD's version)
I like ed but I prefer 'sam -d' (the terminal mode of Sam). It has a nice looping construct 'x' and you can open multiple files and do batch edits (with 'X').
There is a Go port of Sam, which is easy to install:
When even “IDEs are complete overkill—just use vi” sounds like weakness and the entitlement of modern youth, seek out the ed fan pages!
ed isn’t quite flipping binary toggle switches to load your program, but close enough to deliver the joy of brutal minimalism along with a nostalgic waft of yesteryear.
> ed isn’t quite flipping binary toggle switches to load your program, but close enough to deliver the joy of brutal minimalism along with a nostalgic waft of yesteryear.
No, that would be Teco, or, more “all we had were zeros”, ED on CP/M.
ED is, well, miserable. It’s a character editor, vs a line editor, and you had the joys of paging in chunks of your file into working memory.
I, personally, find command line character editors especially difficult. I find it very hard to maintain my context and, of course, who doesn’t just love counting characters for commands.
Funny thing about ed: While it is still one of my most common commands, it is also my dad's name. So, I've spent my entire career regularly typing my father's name at work.
ed is the first program I put in exaequOS (https://exaequos.com), an OS fully running in the Web browser. For testing ed, you can open a terminal and type 'ed'
Both GNU ed and OpenBSD ed support wq as an extension to POSIX. But yeah, it all depends on whether you want to stick by POSIX or common practice. I personally prefer wq for interactive sessions and w\nq for scripts.
Still, teaching bash, C and the usual suspects along with ed was very strenuous for the students, and for me - we only ran the course once.