News for hackers. Stuff that matters.
Re:Ed(1) mastery is a must for a real Unix person by MarkusWandel on Friday December 15, 2023 @11:34AM (#38655773)
Arguably, interactive editing with "ed" is an obsolete skill that went out with 110baud mechanical teletypes.

However, having a basic idea of "sed" is a goldmine for super-quick command line pipeline kinds of tricks. Even in this day and age.

Re:Ed(1) mastery is a must for a real Unix person by bodyfour on Friday December 15, 2023 @11:50AM (#38655933)
It remained a valuable skill into the 1990s when many UNIX machines still had a separate /usr partition.

Many times I'd have to fix a server with a configuration issue causing /usr to not mount correctly on boot. When you're at a single-user shell and no /usr/bin/vi is available suddenly knowing the basics of /bin/ed becomes very useful.

Of course these days most UNIXes moved away from a separate /usr partition so if the root filesystem mounts you have a full-featured vim.

Re:Ed(1) mastery is a must for a real Unix person by macintux on Friday December 15, 2023 @11:52AM (#38655955)
ed also was, at least on LPMuds in the 90s, the only online editor. It was a bit crippled, but still recognizably ed.
Re:Ed(1) mastery is a must for a real Unix person by Voultapher on Friday December 15, 2023 @11:53AM (#38655962)
PSA if you use sed with anything but trivial patterns, consider supplying the pattern via file `sed -f script.sed`. Saves you a lot of sanity not having to escape everything in arcane shell + regex escape rules.
Re:Ed(1) mastery is a must for a real Unix person by medoc on Friday December 15, 2023 @11:58AM (#38656009)
I used ed on video terminals connected to VME 68000 Unix V7 machines around 1986. For some reason, I don't remember using vi on them, and in any case, ed remained very useful when the terminal type was misconfigured or unknown to the system, which happened quite a lot (I guess that not everything emulated a VT100 at the time). We actually jumped directly from ed to some Emacs relative (Jove probably), which was the beginning of paradise, and then we received our Sun 3 and it was Emacs all the way to present :)
Re:Ed(1) mastery is a must for a real Unix person by cylinder714 on Friday December 15, 2023 @06:17PM (#38660063)
vi is painful over slow lines, maybe that was it? When I started at SCO in '86 my terminal connected at 9600 baud to a VME 68000 box named "scotty" running Xenix. (All our servers had names containing "sco". Over the years I think we had to settle for just having the letters somewhere in the name.) 9600 baud was luxury after university, where all our terminals connected at 2400 baud.
Re:Ed(1) mastery is a must for a real Unix person by omoikane on Friday December 15, 2023 @11:43AM (#38655866)
ed is still great if I just want to fix a few lines remotely over a terminal. You might say ed is interactive sed :)
Re:Ed(1) mastery is a must for a real Unix person by alchemist1e9 on Friday December 15, 2023 @11:50AM (#38655931)
Ironically I’m studying all the oldest of oldest UNIX utilities that can work well over a pure teletype style terminal, think a LA34 DECwriter IV. No ncurses, no TUI. only line feeds and also ink is scarce.

Why? Because we have a new friend in the house who effectively has to interact with the outside world via teletype terminal.

The LLMs!

Re:Ed(1) mastery is a must for a real Unix person by bodyfour on Friday December 15, 2023 @11:53AM (#38655959)
A great point, but even over a teletype you'd use "ex", not "ed".
Re:Ed(1) mastery is a must for a real Unix person by alchemist1e9 on Friday December 15, 2023 @11:57AM (#38656003)
Totally true! Thank you for reminding me of ex.
Re:Ed(1) mastery is a must for a real Unix person by bee_rider on Friday December 15, 2023 @11:48AM (#38655914)
sed and vi both have roots in ed, right? So you only needed one more round of advancement from ed to reach peak computing.

I mean we’re all joking in this thread to some extent, but actually, I don’t know that I don’t believe this.

Re:Ed(1) mastery is a must for a real Unix person by omoikane on Friday December 15, 2023 @12:35PM (#38656430)
> sed and vi both have roots in ed

A joke I used to tell people is "don't know how to quit vi? Just type Q to enter Ex mode, then you can exit vi just like how you would exit ed."

Re:Ed(1) mastery is a must for a real Unix person by bee_rider on Friday December 15, 2023 @12:44PM (#38656531)
Clearly the solution is :!killall vi or something along those lines.
Re:Ed(1) mastery is a must for a real Unix person by chefandy on Friday December 15, 2023 @03:34PM (#38658481)
Curious: Why would you use ed over ex, or vi for that matter?
Re:Ed(1) mastery is a must for a real Unix person by omoikane on Friday December 15, 2023 @05:28PM (#38659613)
"ed" is easier to type than "ex" but mostly it's a matter of habit. On some systems, /bin/ed is a separate binary but /usr/bin/ex is actually just a symlink to vim, and at that point I might as well run vim.

As to why I run "ed" instead of "vi": if I get just a few errors from some script I just copied over, I could run "ed" and the error message is still on the screen (because ed doesn't repaint the whole screen). I would run vi and screen if I expect to fix more than just a few lines.

Re:Ed(1) mastery is a must for a real Unix person by chefandy on Sunday December 17, 2023 @04:37PM (#38676703)
makes sense