box.matto.nl
Enjoying Open Source Software

Having fun using the ED editor

Ed is the standard text editor

Ed is a so-called line editor, was developed by Ken Thompson in the early days. Ed was developed on the PDP-7, build in assembly, to be used on the PDP-11.

Ed was one of the first parts of the Unix operating system that was developed, in August 1969 and was used to write most of the original Unix code.

See also the nice text on: http://www.darwinsys.com/history/hist.html.

It is very useful to learn how to use the Ed editor or at least the basics. In Unix systems, like the family of Berkeley Software Distribution (BSD) systems, Ed is the standard editor. For instance, the OpenBSD install image, that you can also use as a small BSD system by dropping a shell, contains Ed, and you won't find vi in this image. Also, powerful automation can be achieved by feeding commands from standard input through so-called here-documents.

Modal editor

Ed is a modal editor, just like vi (and ex). After initialization, Ed is command mode. You switch to insert mode by using one of the insert commands, a (append), c (change), or i (insert). Switching back to command mode is done by typing a newline containing only a single dot (.). This will end the insert mode and put you back into command mode.

It is easier to recognize the mode when you activate the prompt in Ed, either by the command 'P' after initialization, or with the -p flag when starting Ed.

For fun and profit

So, learning to use Ed can safe your bacon, and prevent some panic, when you have to do some disaster recovery. Also, you learn a lot about using a line editor. Ed and ex (the line editor in vi) are not that different.

What is really amazing, is the raw power that is already there in Ed. Ed supports regular expressions. When you learn Ed and use it for real work, you get a glimpse of the genius of Ken Thompson.

As far as productivity in writing goes, nothing can beat vi (except, perhaps, vim). But that does not mean that you can not do any real work in Ed. I recently used Ed to write the manuscript for a complete three-page article for a magazine :)

There are many good resources that can help you to master Ed.

Use regularly

So, it is useful and fun to learn and practice to use Ed. Use it at least once a month for doing some real work, so your Ed-skills won't get rusty.

Tags:

⇽ Switched to st terminal emulator Using par with Ed ⇾