Live data from Hacker News

Actually using Ed

blog.sanctum.geek.nz

41–50 of 92 posts

Re: Actually using Ed

#41
post #39

Monday is a "Ride to work day" for motorcyclists. I think this same thinking should be applied to ed! Think of it: One day, every year, there should be a "Use ed (the standard editor) day". On that day, all your text editing must happen with 'ed'. Who's with me?

    a
    I'm with you!
    .
    quit
    ?
    exit
    ?
    q
    ?
    q

Re: Actually using Ed

#42

I'm glad ed is there. I'm glad articles like this are there. But there is no way I'll have retained that article in the moment my terminal has borked and I actually need ed. I wish that something like this available in the man pages, or something like them, or at least referred to in them. Because maybe I'm not clever enough but I don't find the man page articles to be very good introductions. As reminders of syntax…

On many systems you should be able to unbork the terminal with 'reset' or 'tput reset'. Then you do not need ed ;)

That's only going to fix a few causes of borked-ness. If the remote system doesn't have a termcap for your terminal, reset doesn't do much. In that case, setting TERM=vt100 will probably help matters, unless you're on a really obscure terminal of some sort.

Re: Actually using Ed

#43
post #10

If you’re using any Unix at all, then ed really will always be there, no matter how old or limited the system. So as it turns out, my Arch Linux setup does not actually have ed.

> Arch Linux setup does not actually have ed.

They did specify Unix.

Re: Actually using Ed

#44

I'm glad ed is there. I'm glad articles like this are there. But there is no way I'll have retained that article in the moment my terminal has borked and I actually need ed. I wish that something like this available in the man pages, or something like them, or at least referred to in them. Because maybe I'm not clever enough but I don't find the man page articles to be very good introductions. As reminders of syntax…

Info pages are utterly useless--I don't think I've ever had anything useful from there. If I've screwed my system up so badly I need to use ed, even "man" might not necessarily work (these days GNU commands are just so damn clever). Best thing is usually to grab another computer or your smartphone and start Googling.

Re: Actually using Ed

#45
Having been a user of *NIX for over 20 years and a professional Systems Administrator for over 10, I have never once had a reason to use ed. Even the smallest embedded environments usually have some variant of vi available. The only time that I've needed to use ed was edlin in the dark days of early MS-DOS, which is very similar. This is borderline masochistic.

Re: Actually using Ed

#46
post #2

That was a good explanation. I hope never to have to use ed.

Even today 'ed' has practical uses apart from being the default emergency backup of the backup editor.

One situation where I always use 'ed' is when I reinstall a machine (with the same ip) and ssh tells me the keys don't match together with the line number in the file known_hosts. It's easy as: #ed ~/.ssh/known_hosts 15d wq

(assuming the mismatching line was 15). Only sed would be faster if it wasn't for the time spent always looking up the "-i" (edit in place) flag, so I just use ed.

Also knowing a little 'ed' will make working with 'vi' easier, assuming 'vi' is not your usual editor.

Re: Actually using Ed

#47
post #43
post #10

If you’re using any Unix at all, then ed really will always be there, no matter how old or limited the system. So as it turns out, my Arch Linux setup does not actually have ed.

> Arch Linux setup does not actually have ed. They did specify Unix.

I don't know if unix is the most ahem "specific" specification ever given. What specification of unix do you think the author was referring to? In any case, they have corrected themselves in the blogpost.

Re: Actually using Ed

#48

Having been a user of *NIX for over 20 years and a professional Systems Administrator for over 10, I have never once had a reason to use ed. Even the smallest embedded environments usually have some variant of vi available. The only time that I've needed to use ed was edlin in the dark days of early MS-DOS, which is very similar. This is borderline masochistic.

It's not whether 'vi' is available (it usually is), but whether it is behaving properly. Situations do occur where any fullscreen editor will fail and where 'ed' will work as expected. And at such moments, even though you don't know the full extent of the power of 'ed' you will be happy to know how to change a line and save the config file (and actually quit 'ed'; that's harder than it sounds)

An editor in need is an editor indeed!

Re: Actually using Ed

#49
post #37
post #20

Earlier quoted context omitted.

Why? We have better alternatives, and clearly things can work without it.

What better alternatives are there? Even if you prefer vi for interactive edits, I still prefer ed for small edits. Then there are times when your terminal is borken (or as somebody mentioned, perhaps even your keyboard is broken), this still happens more often than you think. Recently I had to use some ajax-term thing which was just awful and completely unable to run vi properly for who knows what reason, anything t…

I'm honestly curious - what's a use case for scripting the editing of files that's not better satisfied by using a scripting language? I see the value of Arch's focus on minimalism more than keeping ed around in this case, but I'm happy to be wrong.

If your terminal is broken, there are plenty of ways (reset, stty sane, whatever) to fix that. I'm also not sure why having an extra binary on my system is a good safety guard against a broken keyboard.

The ajax term case is valid I guess, though I'm not sure how common that is. I was in a case like that a year or so ago and ended up using cat and sed to get the thing back on the network.

Re: Actually using Ed

#50

Having been a user of *NIX for over 20 years and a professional Systems Administrator for over 10, I have never once had a reason to use ed. Even the smallest embedded environments usually have some variant of vi available. The only time that I've needed to use ed was edlin in the dark days of early MS-DOS, which is very similar. This is borderline masochistic.

Apples to oranges.
Post reply on HN