Ed (text editor)

related topics
{system, computer, user}
{math, number, function}
{work, book, publish}
{language, word, form}
{line, north, south}
{@card@, make, design}

ed is a line editor for the Unix operating system. It was one of the first end-user programs hosted on the system and has been standard in Unix-based systems ever since.[1] ed was originally written in PDP-11/20 assembler by Ken Thompson in 1971. Ken Thompson was very familiar with an earlier editor known as qed from University of California at Berkeley, Ken Thompson's alma mater; he reimplemented qed on the CTSS and Multics systems, so it is natural that he carried many features of qed forward into ed.[2] Ken Thompson's versions of qed were the first to implement regular expressions, an idea that had previously been formalized in a mathematical paper, which Ken Thompson had read. The implementation of regular expressions in ed is considerably less general than the implementation in qed.

ed went on to influence ex, which in turn spawned vi. The non-interactive Unix command grep was inspired by a common special uses of qed and later ed, where the command g/re/p means globally search for the regular expression re and print the lines containing it. The Unix stream editor, sed implemented many of the scripting features of qed that were not supported by ed on Unix; sed, in turn, influenced the design of the programming language AWK, which in turn inspired aspects of Perl.



Features of ed include:

  • available on nearly all computer systems
  • a modal editor supporting command mode, text mode and viewing mode
  • support for regular expressions
  • powerful automation can be achieved by feeding commands from standard input

Famous for its terseness, ed gives almost no visual feedback. For example, the message that ed will produce in case of error, or when it wants to make sure the user wishes to quit without saving, is "?". It does not report the current filename or line number, or even display the results of a change to the text, unless requested. This terseness was appropriate in the early versions of Unix, when consoles were teletypes, modems were slow, and memory was precious. As computer technology improved and these constraints were loosened, editors with more visual feedback became the standard.

In current practice, ed is rarely used interactively, but does find use in some shell scripts. For interactive use, ed was subsumed by the sam, vi and Emacs editors in the 1980s. ed can be found on virtually every version of Unix and Linux available, and as such is useful for people who have to work with multiple versions of Unix. If something goes wrong, ed is sometimes the only editor available. This is often the only time when it is used interactively.

Full article ▸

related documents
Wide area information server
Parasitic computing
Monolithic kernel
Remote procedure call
Access control list
Manual page (Unix)
Run-length encoding
IBM 1620 Model I
Microsoft BASIC
Pentium FDIV bug
Analytical engine
Synchronized Multimedia Integration Language
LZ77 and LZ78
OpenGL Utility Toolkit
Creator code
Nautilus (file manager)
Korn shell
Program counter
Server-side scripting
Pseudonymous remailer
Portable Distributed Objects
Application binary interface
Mutual exclusion