changed. Any lines in the buffer are deleted before the output of command is read. The current address is set to the last line read.
ecommand, except that unwritten changes are discarded without warning. The current address is set to the last line read.
gcommand, the current address is set to the last line affected by command-list. If no lines were matched, the current line number remains unchanged. Each command in command-list must be on a separate line, and every line except for the last must be terminated by a backslash (‘\’). Any commands are allowed, except for
V. A newline alone in command-list is equivalent to a
Gcommand, the current address is set to the last line affected by (the last) command-list. If no lines were matched, the current line number remains unchanged. The format of command-list is the same as that of the
gcommand. A newline alone acts as a null command list. A single ‘&’ repeats the last non-null command list.
edscripts begin with this command to aid in debugging.
'lc (i.e., a single quote followed by lc) in subsequent commands. The mark is not cleared until the line is deleted or otherwise modified.
-pstring, the command prompt is by default turned off.
edunconditionally. This is similar to the
qcommand, except that unwritten changes are discarded without warning.
!command below). The default filename is unchanged. The current address is set to the last line read.
g(global) suffix is given, then every match is replaced. The n suffix, where n is a positive number, causes only the nth match to be replaced. It is an error if no substitutions are performed on any of the addressed lines. The current address is set the last line affected. re and replacement may be delimited by any character other than space and newline (see the
scommand below). If one or two of the last delimiters is omitted, then the last line affected is printed as though the print suffix
pwere specified. An unescaped ‘
&’ in replacement is replaced by the currently matched text. The character sequence \m, where m is a number in the range [1,9], is replaced by the mth backreference expression of the matched text. If replacement consists of a single ‘
%’, then replacement from the last substitution is used. Newlines may be embedded in replacement if they are escaped with a backslash (‘
scommand accepts a count suffix n, or any combination of the characters
p. If a count suffix n is given, then only the nth match is replaced. The
rsuffix causes the regular expression of the last search to be used instead of that of the last substitution. The
gsuffix toggles the global suffix of the last substitution. The
psuffix toggles the print suffix of the last substitution. The current address is set to the last line affected.
Vare treated as a single command by undo.
uis its own inverse.
!command below). The default filename and current address are unchanged.
wcommand, except that the previous contents of file are not clobbered. The current address is unchanged.
eddoes not process command for ‘\’ (backslash) escapes. However, an unescaped ‘%’ is replaced by the default filename. When the shell returns from execution, a ‘!’ is printed to the standard output. The current line is unchanged.
edattempts to write the buffer to the file ed.hup. Nothing is written to the currently remembered file, and
edprints ‘?\n’ and returns to command mode. If interrupted during text input, the text already input is written to the current buffer, as if text input had been normally terminated.
edattempts to write the buffer if the terminal hangs up
edutility exits 0 on success, and >0 if an error occurs.
edprints a ‘?’ and either returns to command mode or exits if its input is from a script. An explanation of the last error can be printed with the
h(help) command. Since the
g(global) command masks any errors from failed searches and substitutions, it can be used to perform conditional operations in scripts; e.g.,
u(undo) command occurs in a global command list, then the command list is executed only once. If diagnostics are not disabled, attempting to quit
edor edit