Command Reference Guide

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man1/!!!intro.1
________________________________________________________________
___ ___
e
ex(1) ex(1)
+n, +[+]...
-n, -[-]...
An offset relative to the current line or the preceding line specification. + means for-
ward; - means backward. For example, the forms .+3, +3, and +++ are equivalent.
/re/
?
re?
The line containing the pattern re, scanning forward (/) or backward (?). The trailing
/ or ? can be omitted if the line is only being displayed. If re is omitted, ex uses the
more recently set of either the scanning string or the substitution string (see Regular
Expressions below).
x Lines can be marked using single lowercase letters (see the mark command in Com-
mand Descriptions below). x refers to the line marked with x. In addition, the pre-
vious current line is marked before each nonrelative motion. This line can be referred
to by using for x (thus ’’ refers to the previous current line).
(XPG4 only.) Commands require zero, one or two addresses. Commands that require
zero addresses shall regard the presence of an address as an error.
(XPG4 only.) Adjacent address in a range shall be separated from each other by a comma (,) or a semi-
colon(;). In the latter case, the current line(.) shall be set to the first address, and only then is the second
address calculated. This feature can be ued to determine the starting line for forwards and backwards
searches. The second address of any two-address sequence shall correspond to the first address. The first
address shall be less than or equal to the second address. The first address shall be greater than or equal to
the first line of the editing buffer, and the last address shallbe less than or equal to the last line of the edit-
ing buffer. Any other case shall be an error.
Addresses for commands consist of a series of line addresses (specified as above), separated by a comma (
,)
or semicolon (
;). Such address lists are evaluated left-to-right. When the separator is a semicolon, the
current line is set to the value of the previous address before the next address is interpreted. If more
addresses are given than the command requires, then all but the last one or two are ignored. Where a com-
mand requires two addresses, the first line addressed must precede the second one in the work area. A
null (missing)address in a list defaults to the current line.
Regular Expression
The editor maintains copies of two regular expression strings at all times: the substitution string, and the
scanning string. The substitute command sets the substitution string to the regular expression used. Both
the global-command and the regular-expression form of line addressing (see Addressing above) for all com-
mands set the scanning string to the regular expression used. These strings are used as default regular
expressions as described under Addressing, the global command, and the substitute command.
The editor supports Basic Regular Expressions (see regexp(5)) with the following modifications:
\< The \< matches the beginning of a "word"; that is, the matched string must begin in a
letter, digit, or underline, and must be preceded by the beginning of the line or a charac-
ter other than the above. This construct can only be used at the beginning of a regular
expression (as in \<word), but not in the middle (word1 \<word2).
\> The \> matches the end of a "word" (see previous paragraph). This construct can only be
used at the end of a regular expression (as in word\>), but not in the middle (word1\>
word2).
~ Match the replacement part of the last substitute command.
[string] The positional quoting within bracket expressions defined by Basic Regular Expressions
is replaced by the use of the backslash(\) to quote bracket-expression special characters.
nomagic When the editor option nomagic is set, the only characters with special meanings are ˆ
at the beginning of a pattern, $ at the end of a pattern, and \. The characters ., *,
[,
and
˜ lose their special meanings unless escaped by a \.
Replacement Strings
The character & in the replacement string stands for the text matched by the pattern to be replaced. Use
\& if the nomagic editor option is set.
The character ˜ is replaced by the replacement part of the previous substitute command. Use if
the nomagic editor option is set.
The sequence \n, where n is an integer, is replaced by the text matched by the subpattern enclosed in the
nth set of parentheses \( and \).
HP-UX Release 11i: December 2000 3 Section 1243
___
___