r 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 another file before writing a modified buffer results in an error. If the command is entered a second time, it succeeds, but any changes to the buffer are lost. sed(1), sh(1), vi(1), re_format(7) B. W. Kernighan and P. J. Plauger, Software Tools in Pascal, 1981, Addison-Wesley.
edutility is compliant with the IEEE Std 1003.1-2008 (“POSIX.1”) specification. The commands
s(to repeat the last substitution),
zas well as the address specifier ‘%’ are extensions to that specification. The IEEE Std 1003.1-2008 (“POSIX.1”) specification says the ‘^’ address specifier is neither required nor prohibited; additionally, it says behaviour for the
-option is “unspecified”.
edcommand appeared in Version 1 AT&T UNIX.
edprocesses file arguments for backslash escapes, i.e., in a filename, any characters preceded by a backslash (‘
\’) are interpreted literally. If a text (non-binary) file is not terminated by a newline character, then
edappends one on reading/writing it. In the case of a binary file,
eddoes not append a newline on reading/writing.
|April 26, 2018||OpenBSD-current|