Ed (software)
ed (pronounced as distinct letters, /ˌiːˈdiː/)[1] is a line editor for Unix and Unix-like operating systems. It was one of the first parts of the Unix operating system that was developed, in August 1969.[2] It remains part of the POSIX and Open Group standards for Unix-based operating systems,[3] alongside the more sophisticated full-screen editor vi. History and influenceThe ed text editor was one of the first three key elements of the Unix operating system—assembler, editor, and shell—developed by Ken Thompson in August 1969 on a PDP-7 at AT&T Bell Labs.[2] Many features of ed came from the qed text editor developed at Thompson's alma mater University of California, Berkeley.[4] Thompson was very familiar with qed, and had reimplemented it on the CTSS and Multics systems. Thompson's versions of qed were notable as the first to implement regular expressions. Regular expressions are also implemented in ed, though their implementation is considerably less general than that in qed. Dennis M. Ritchie produced what Doug McIlroy later described as the "definitive" ed,[5] and aspects of ed went on to influence ex, which in turn spawned vi. The non-interactive Unix command grep was inspired by a common special use of qed and later ed, where the command FeaturesFeatures of ed include:
Known for its terseness, ed, compatible with teletype terminals like Teletype Model 33, gives almost no visual feedback,[8] and has been called (by Peter H. Salus) "the most user-hostile editor ever created", even when compared to the contemporary (and notoriously complex) TECO.[2] For example, the message that ed will produce in case of error, and 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. Older versions (c. 1981) did not even ask for confirmation when a quit command was issued without the user saving changes.[8] 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 norm. 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. On Unix-based operating systems, some utilities like SQL*Plus run ed as the editor if the EDITOR and VISUAL environment variables are not defined.[9] If something goes wrong, ed is sometimes the only editor available. This is often the only time when it is used interactively. The version of ed provided by GNU has a few switches to enhance the feedback. Using The ed commands are often imitated in other line-based editors. For example, EDLIN in early MS-DOS versions and 32-bit versions of Windows NT has a somewhat similar syntax, and text editors in many MUDs (LPMud and descendants, for example) use ed-like syntax. These editors, however, are typically more limited in function. ExampleHere is an example transcript of an ed session. For clarity, commands and text typed by the user are in normal face, and output from ed is emphasized. a ed is the standard Unix text editor. This is line number two. . 2i The end result is a simple text file ed is the standard Unix text editor. Started with an empty file, the In the line Once the empty line is inserted in line 2, the line which reads "This is line number two." is now actually the third line. This error is corrected with
Cultural referencesThe GNU Project has numerous jokes around ed hosted on its website. In addition, the glibc documentation notes an error code called See also
References
External linksThe Wikibook Guide to Unix has a page on the topic of: Commands
|