Live data from Hacker News

Actually using Ed

blog.sanctum.geek.nz

31–40 of 92 posts

Re: Actually using Ed

#31

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 ;)

Re: Actually using Ed

#32
post #2

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

I had to use it more than once, typically when running on a hosed system, typically from within some miniroot/initrd/ramfs when the machine wouldn't boot and no full screen editor would run because of missing termcaps. However, cat is actually easier to use as a quick emergency editor (if you know how to use ^W,^U,^D and friends). Unless you're stuck using an ASR-33 :)

Re: Actually using Ed

#33
You forgot to mention a very important feature: You can use regular expressions in ranges too, and thus for example use .,/^$/d to kill the rest of the paragraph (or .,/^$/c to change the rest of the paragraph).

Re: Actually using Ed

#34
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.

My OpenWRT box does not have ed either.

In my experience, the closest approximation of an editor which will always be there in the real world is sed, not ed.

Re: Actually using Ed

#35
post #20
post #12

Earlier quoted context omitted.

It is a very sad and distressing trend that some Linux distros don't include ed in their base systems. Ed is as essential to a Unix system as cat or grep.

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

From what I understand, it's used as a scriptable editor in UNIX automation. It may not be used that often, but it's something I think people expect to be there when a particular piece of behaviour is desired. (Not that I've ever used it myself either interactively or scripted).

It also appears to be part of POSIX.

I imagine though that ex would be the more capable alternative, and since vi is also ubiquitous, I guess that makes ex ubiquitous too. So I can see your point.

Re: Actually using Ed

#36
I used to work at a place where their mission critical software was running on ancient HP-UX boxes which we feared to turn off because we didn't know if they would turn back on. My job was to port this software to modern Ubuntu VMs. Once I was done, we had a celebration in which we turned off the HP-UX boxes forever... except of course there was a bug in my version, so we soon had to turn them back on while I worked on a fix.

To everybody's surprise, the machines did turn back on, but they couldn't connect to the network because a few configuration files were wrong. To our dismay, after we tried to use Vi to edit the first one, we discovered that the ESC key did not work anymore, and we were stuck in edit mode forever! We had to reboot the machine, which takes about an hour on these old machines.

And then of course I configured the files using Ed and saved the day! Surprisingly, I was the youngest programmer there and I was the only one who knew how to use it.

Re: Actually using Ed

#37
post #20
post #12

Earlier quoted context omitted.

It is a very sad and distressing trend that some Linux distros don't include ed in their base systems. Ed is as essential to a Unix system as cat or grep.

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 that depends on curses can not be considered reliable.

But more importantly it is the standard and portable tool for scripting the editing of files.

Re: Actually using Ed

#38
post #14
post #5

I use ed frequently for writing quick scripts. Its edge is that you can use it while retaining visual history of the prompt. Though, you could instead just redirect cat to a file and then do any tidy-up in your usual editor. It's also sometimes useful when you're in a remote system that is behaving strangely due to screwed-up terminal definitions or some other catastrophe. I'd be interested to read a sam tutorial foc…

Yes, I'm a user of ed regularly as well when I would like to mingle interacting with it with my other before and after command line use. If you use vim then `:set t_ti= t_te=' may be of interest to stop it switching to the terminal's other buffer and back; that way on exiting the file's content remains to copy-and-paste from. The article was OK. I'm not sure it mentioned addressing line 0 for the start of the file, a…

Thanks for that link. 1987! Where's my structural-regexp-enabled awk!?

Re: Actually using Ed

#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?

Re: Actually using Ed

#40

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…

Linux man pages are notoriously verbose, and often obtuse and incomplete, this is in great part due to the extra complexity of GNU tools and their preference for the infamous info documentation system.

OpenBSD has probably the best Unix manual pages:

http://www.openbsd.org/cgi-bin/man.cgi?query=ed

And Plan 9 has a manual that is a pleasure to read, this is helped in part because the commands themselves have been cleaned up and simplified in many cases:

http://man.cat-v.org/p9p/1/ed

Post reply on HN