Live data from Hacker News

Actually using Ed

blog.sanctum.geek.nz

61–70 of 92 posts

Re: Actually using Ed

#61

Earlier quoted context omitted.

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.

That last happened to me fairly recently, when a server was unable to mount /usr (where the termcap stuff lives) and I had to use ed to edit the RAID config files so that I could mount it. Fun times.

Re: Actually using Ed

#63
post #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 clea…

I think instead of `verbose' you meant the opposite `terse.'

Re: Actually using Ed

#64
post #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…

You could have just typed CTRL+[ or CTRL+C, both exit insert mode in Vi. It's in the man page: http://nixdoc.net/man-pages/hp-ux/man1/vi.1.html

Re: Actually using Ed

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

Because ed is the standard text editor.

Re: Actually using Ed

#66

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.

I own a Unix introduction book from the early 80s (I think) that describes a customized/extended version of ed as the author's choice of text editor. vi is mentioned as "this newfangled editor that has more features than anyone needs and is such an incredible resource hog that it leaves barely any memory for the actual document on a large PDP-11".

Re: Actually using Ed

#67

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…

If you want an ed(1) tutorial why not try Brian Kernighan's original? http://nietzschegym.com/edtut.pdf

Re: Actually using Ed

#68
post #40

Earlier quoted context omitted.

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 clea…

I think instead of `verbose' you meant the opposite `terse.'

They're either the output of --help turned into -man macros or more noise than signal. Damn info!

Re: Actually using Ed

#69
post #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.

[deleted]

Re: Actually using Ed

#70
I think a lot of C programmers would find reading the source to the V6 ed interesting:

  http://www.tuhs.org/Archive/PDP-11/Trees/V6/usr/source/s1/ed.c
1333 lines of C, basically no library use at all (no printf, not even malloc -- the only thing dynamically allocated is the document, and it uses sbrk() to manage the memory itself), compiles down to about 6K on a PDP-11. And that includes a regex engine!

It contains a lot of 1970 C-isms that won't work today ("=+" instead of "+=" for example) but an experienced C programmer shouldn't have a hard time following it.

As a bonus, look at the commented-out getpid() implementation at the bottom of the file.

Post reply on HN