Live data from Hacker News

Actually using Ed

blog.sanctum.geek.nz

11–20 of 92 posts

Re: Actually using Ed

#11
"ed really will always be there"

When I set out to learn ed, I was surprised that it was not included by default on my Arch Linux install. It was easy enough to add via Pacman but it still surprised me.

Re: Actually using Ed

#12

"ed really will always be there" When I set out to learn ed, I was surprised that it was not included by default on my Arch Linux install. It was easy enough to add via Pacman but it still surprised me.

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.

Re: Actually using Ed

#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, and comma is more common than % for all lines. ed(1) is brief and lots can be learned from it.

As for structural regular expressions as used in sam(1), see Rob Pike's paper. http://doc.cat-v.org/bell_labs/structural_regexps/

Re: Actually using Ed

#16
post #9
post #2

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

You may occasionally want to use its little brother, `sed`, which has substantially similar syntax. It is often the case in Unix programming that you have a pipe full of text data and you would like to transform every line of it; `sed` allows you to write these transforms into one line of instructions on the console line. So it may sound crazy that you have all of these terse commands, but just imagine that you're tr…

I used to use sed, but more recently I've been using 'perl -pe' instead, which is a drop-in replacement for the basic 's//' use I typically make of sed. The main reason is that I've had some performance problems with sed, depending on which of the several sed variants is installed. Many of them seem to have small fixed buffers that really limit throughput when processing large (multi-gigabyte) files, and the performance ends up being really unpredictable, while Perl's regex engine is fairly good and similar across platforms. (Also, I'm trying to avoid having to maintain both POSIX-style and PCRE-style regex syntax in different scripts, but that may be a matter of preference.)

Re: Actually using Ed

#17
I love ed. A long time ago when I was mastering it, I made an ed cheat sheet. Here it is the article about it:

http://www.catonmat.net/blog/ed-unix-text-editor-cheat-sheet...

And here is the cheat sheet itself:

pdf: http://www.catonmat.net/download/ed.text.editor.cheat.sheet....

txt: http://www.catonmat.net/download/ed.unix.text.editor.cheat.s...

doc: http://www.catonmat.net/download/ed.text.editor.cheat.sheet....

Re: Actually using Ed

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

  If you’re using any Unix at all, then ed really 
  will always be there, no matter how old or limited 
  the system. Well, unless you use Arch Linux, anyway.

Re: Actually using Ed

#20
post #12

"ed really will always be there" When I set out to learn ed, I was surprised that it was not included by default on my Arch Linux install. It was easy enough to add via Pacman but it still surprised me.

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.
Post reply on HN