Command Reference Guide

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man1/!!!intro.1
________________________________________________________________
___ ___
e
ed(1) ed(1)
(.,.)c
text
.
The c (change) command deletes the addressed lines then accepts input text to replace the
deleted lines. Upon completion, the new current line is the last line in text or, if no text
was provided, at the first line after the deleted line or lines.
(.,.)d The d (delete) command deletes the addressed lines from the buffer. Upon completion, the
new current line is the first line following the deleted text, or the last line in the file if the
deleted line or lines were at the end of the buffer.
e file The e (edit) command deletes the entire contents of the buffer, then reads in the named
file. Upon completion, the new current line is the last line in the buffer. If no file name is
given, the remembered file name, if any, is used (see the f command). The number of
characters read is displayed, and file is remembered for possible use as a default file name
in subsequent e, r,orw commands.
If the file name starts with !, the rest of the line is interpreted as a shell command whose
standard output is to be read. Such a shell command is not remembered as the current file
name.
Also see DIAGNOSTICS below.
E file The E (forced edit) command is identical to
e except that no check is made to ensure that
the current buffer has not been altered since the last
w command.
f file If file is specified, the f (file name) command changes the remembered file name to file.
Otherwise, it prints the remembered file name.
(
1,$)g/RE/command-list
The g (global) command first marks every line that matches the given RE. Then, for every
such line, the given command-list is executed with the current line initially set to that line.
A single command or the first of a list of commands appears on the same line as the global
command. All lines of a multiple-line list except the last line must end with a backslash
(\). a, i, and c commands and associated input are permitted. The . that normally ter-
minates input mode can be omitted if it would be the last line of the command-list.An
empty command-list is equivalent to the
p command. The g, G, v, and V commands are
not permitted in the command-list. (Also see WARNINGS below.)
(
1,$)G/RE/ The interactive G (Global) command first marks every line that matches the given RE.
Then, for every such line, the line is printed, then the current line is changed to that line
and one command (other than a, c, i, g, G, v,or
V) can be input and executed. After exe-
cuting that command, the next marked line is printed, and so on. A newline character acts
as a null command, and an
& causes the re-execution of the most recent command executed
within the current invocation of G. Note that the commands input as part of the execution
of the G command may address and affect any lines in the buffer. The
G command can be
terminated by an interrupt signal (ASCII DEL or BREAK).
h The h (help) command gives a short error message explaining the reason for the most
recent ? diagnostic.
H The H (Help) command causes ed to enter a mode in which error messages are printed for
all subsequent ? diagnostics. It also explains the previous ? if there was one. The H com-
mand alternately turns this mode on and off. Initially, it is off.
(.)i
text
.
The i (insert) command inserts the given text before the addressed line. Upon completion,
the current line is the last inserted line, or, if there were none, the addressed line. This
command differs from the a command only in the placement of the input text. Address 0 is
not legal for this command.
(.,.+1)j The j (join) command joins contiguous lines by removing the appropriate newline charac-
ters. If exactly one address is given, this command does nothing.
(.)kx The k (mark) command marks the addressed line with the name x, which must be a lower-
case letter. The address ’x then addresses this line. Upon completion, the new current
line remains unchanged from before.
(.,.)l The l (list) command writes the addressed lines to standard output in a visually unambigu-
ous form. Characters listed in the following table are written as the corresponding escape
sequence. Nonprintable characters not in the table are written as a three-digit octal
number (with a preceding backslash character) for each byte in the character (most
significant byte first).
HP-UX Release 11i: December 2000 − 3 − Section 1−−197
___
___