It is used to create, display, modify and otherwise manipulate text files, both interactively and via shell scripts. A restricted version of ed , red , can only edit files in the current directory and cannot execute shell commands. For most purposes, however, it is superceded by full-screen editors such as Emacs and Vi. The sample sessions below illustrate some basic concepts of line editing with ed . As with the shell, all input to ed must be followed by a newline character.
Roses have thorns, and filvers foutians mud.
Clouds and eclipses stain both moon and sun, And loathsome canker lives in sweetest bud. . When first invoked, ed is in command mode. In this mode commands are read from the standard input and executed to manipulate the contents of the editor buffer. This is the primary means of adding text to a file. A line consists of the text up to and including a newline character.