AT&T UNIX™PC Unix System V Users Manual - tenox
AT&T UNIX™PC Unix System V Users Manual - tenox AT&T UNIX™PC Unix System V Users Manual - tenox
ED ( l ) ED {1) the RE. The REs allowed by ed are constructed as follows: The following one-character REs match a single character: 1.1 An ordinary character (not one of those discussed in 1.2 below) is a one-character RE that matches itself. 1.2 A backslash ( \) followed by any special character is a onecharacter RE that matches the special character itself. The special characters are: a. ., *, [, and \ (period, asterisk, left square bracket, and backslash, respectively), which are always special, except when they appear within square brackets ( []; see 1.4 below). b. A (caret or circumflex), which is special at the beginning of an entire RE (see 3.1 and 3.2 below), or when it immediately follows the left of a pair of square brackets ( [ ])(see 1.4 below). c. $ (currency symbol), which is special at the end of an entire RE (see 3.2 below). d. The character used to bound (i.e., delimit) an entire RE, which is special for that RE (for example, see how slash ( /) is used in the g command, below.) 1.3 A period ( • ) is a one-character RE that matches any character except new-line. 1.4 A non-empty string of characters enclosed in square brackets � ( [ ] ) is a one-character RE that matches any one character 1 in that string. If, however, the first character of the string is a circumflex ( A ) , the one-character RE matches any character except new-line and the remaining characters in the string. The "' has this special meaning only if it occurs first in the string. The minus (-) may be used to indicate a range of consecutive ASCII characters; for example, [0-9] is equivalent to [0 123456789]. The - loses this special meaning if it occurs first (after an initial A , if any) or last in the string. The right square bracket (] ) does not terminate such a string when it is the first character within it (after an initial A , if any); e.g., []a.-f) matches either a right square bracket (]) or one of the letters a. through f inclusive. The four characters listed in 1.2.a above stand for themselves within such a string of characters. The following rules may be used to construct REs from onecharacter REs: 2.1 A one-character RE is aRE that matches whatever the onecharacter RE matches. 2. 2 A one-character RE followed by an asterisk ( *) is a RE that matches zero or more occurrences of the one-character RE. If there is any choice, the longest leftmost string that permits a match is chosen. - 2- � I
� I ED ( 1) ED (1) 2.3 A one-character RE followed by \ { m \}, \ { m, \}, or \ { m, n \} is a RE that matches a range of occurrences of the one-character RE. The values of m and n must be nonnegative integers less than 256; \ { m \} matches exactly m occurrences; \{ m, \} matches at least m occurrences; \{ m, n\} matches any number of occurrences between m and n inclusive. Whenever a choice exists, the RE matches as many occurrences as possible. 2.4 The concatenation of REs is aRE that matches the concatenation of the strings matched by each component of the RE. 2 .5 ARE enclosed between the character sequences \( and \) is aRE that matches whatever the unadorned RE matches. 2.6 The expression \n matches the same string of characters as was matched by an expression enclosed between \( and \) earlier in the same RE. Here n is a digit; the sub-expression specified is that beginning with the n-th occurrence of \( counting from the leit. For example, the expression "\(.*\)\1$ matches a line consisting of two repeated appearances of the same string. Finally, an entire RE may be constrained to match only an initial segment or final segment of a line (or both): 3.1 A circumflex ( " ) at the beginning of an entire RE constrains that RE to match an initial segment of a line. 3.2 A currency symbol ( $) at the end of an entire RE constrains that RE to match a final segment of a line. The construction "entire RE $ constrains the entire RE to match the entire line. The null RE (e.g., I/) is equivalent to the last RE encountered. See also the last paragraph before FILES below. To understand addressing in ed it is necessary to know that at any time there is a current line. Generally speaking, the current line is the last line affected by a command; the exact effect on the current line is discussed under the description of each command. Addresses are constructed as follows: 1 . The character • addresses the current line. 2. The character $ addresses the last line of the buffer. 3. A decimal number n addresses the n-th line of the buffer. 4. 1x addresses the line marked with the mark name character x, which must be a lower-case letter. Lines are marked with the k command described below. 5. A RE enclosed by slashes (I) addresses the first line found by searching forward from the line following the current line toward the end of the buffer and stopping at the first line containing a string matching the RE. If necessary, the search wraps around to the beginning of the buffer and continues up to and including the current line, so that the entire buffer is searched. See also the last paragraph before - 3-
- Page 250 and 251: CPP ( 1) CPP (1) Two special names
- Page 253 and 254: CRYPT { l ) ( Domestic Version Only
- Page 255 and 256: CSPLIT ( 1) CSPLIT (l) NAME csplit
- Page 257 and 258: CU ( lC ) CU ( lC ) NAME cu - call
- Page 259: CU(lC) CU ( lC ) BUGS Cu buffers in
- Page 262 and 263: CUT ( 1) CUT(l) DIAGNOSTICS line to
- Page 264 and 265: CW(l) CW (l) .OW Start of text to b
- Page 266 and 267: CW (l) CW (l) Documents that contai
- Page 268 and 269: .� .• \ __ }
- Page 270 and 271: DATE(l) DATE(l) DIAGNOSTICS No perm
- Page 272 and 273: DC( 1) DC (1) x =x The top two elem
- Page 275 and 276: DD ( 1 ) DD ( 1) NAME dd - convert
- Page 277 and 278: � I DELTA ( l ) DELTA (I) NAME de
- Page 279 and 280: DELTA ( 1) DELTA (!) WARNINGS Lines
- Page 281: DEROFF (l) DEROFF (l) NAME derofi -
- Page 284 and 285: DIFF ( 1) DIFF ( 1) -e producing a
- Page 287: DIFF3 ( 1 ) DIFF3 (1) NAME diff3 -
- Page 291: DIRCMP ( 1) DIRCMP ( 1) NAME dircmp
- Page 295 and 296: DUMP ( 1 ) DUMP(!) NAME dump - dump
- Page 297: ECHO (l) ECHO (l) NAME echo - echo
- Page 302 and 303: ED (l) ED (1) . 6. FILES below. A R
- Page 304 and 305: ED ( 1 ) ED ( 1) command list is eq
- Page 306 and 307: ED (1) ED (l) replaced by the repla
- Page 308 and 309: ED (l) ED (1) FILES /tmp/e# tempora
- Page 311: ENV ( 1) ENV(l) NAME env - set envi
- Page 314 and 315: EQN(l) EQN( 1) [ • '+ � ] � l
- Page 316 and 317: � I )
- Page 318 and 319: EX (l) BUGS EX (l) The undo command
- Page 320 and 321: EXPR(l) EXPR ( l ) 3. 4. returns th
- Page 323 and 324: FC(l) ( AT&T UNIX PC only ) FC ( l
- Page 325: FILE ( 1 ) FIT..E ( 1 ) NAME file -
- Page 328 and 329: FIND ( 1 ) FIND ( 1 ) -print -cpio
- Page 330 and 331: GET(l) -b -ilist -xlist GET(l) furt
- Page 332 and 333: GET(l) GET(l) TABLE 1. Determinatio
- Page 334 and 335: GET(l) GET(l) generated by the get.
- Page 337 and 338: GETOPT ( 1) GETOPT ( l ) NAME getop
- Page 339: GREEK (l) GREEK(l) NAME greek - sel
- Page 342 and 343: GREP ( 1) GREP (1) The order of pre
- Page 344 and 345: � '--- I I I I I I f)
- Page 346 and 347: · r1 . .... .. ._ _ . . r1 ' ·
- Page 348 and 349: HP(l) HP (1) is adjacent to an ASCl
�<br />
I<br />
ED ( 1)<br />
ED (1)<br />
2.3 A one-character RE followed by \ { m \}, \ { m, \}, or<br />
\ { m, n \} is a RE that matches a range of occurrences of<br />
the one-character RE. The values of m and n must be nonnegative<br />
integers less than 256; \ { m \} matches exactly m<br />
occurrences; \{ m, \} matches at least m occurrences;<br />
\{ m, n\} matches any number of occurrences between m<br />
and n inclusive. Whenever a choice exists, the RE matches<br />
as many occurrences as possible.<br />
2.4 The concatenation of REs is aRE that matches the concatenation<br />
of the strings matched by each component of the RE.<br />
2 .5 ARE enclosed between the character sequences \( and \) is<br />
aRE that matches whatever the unadorned RE matches.<br />
2.6 The expression \n matches the same string of characters as<br />
was matched by an expression enclosed between \( and \)<br />
earlier in the same RE. Here n is a digit; the sub-expression<br />
specified is that beginning with the n-th occurrence of \(<br />
counting from the leit. For example, the expression<br />
"\(.*\)\1$ matches a line consisting of two repeated<br />
appearances of the same string.<br />
Finally, an entire RE may be constrained to match only an initial<br />
segment or final segment of a line (or both):<br />
3.1 A circumflex ( " ) at the beginning of an entire RE constrains<br />
that RE to match an initial segment of a line.<br />
3.2 A currency symbol ( $) at the end of an entire RE constrains<br />
that RE to match a final segment of a line.<br />
The construction "entire RE $ constrains the entire RE to match<br />
the entire line.<br />
The null RE (e.g., I/) is equivalent to the last RE encountered.<br />
See also the last paragraph before FILES below.<br />
To understand addressing in ed it is necessary to know that at<br />
any time there is a current line. Generally speaking, the current<br />
line is the last line affected by a command; the exact effect on the<br />
current line is discussed under the description of each command.<br />
Addresses are constructed as follows:<br />
1 . The character • addresses the current line.<br />
2. The character $ addresses the last line of the buffer.<br />
3. A decimal number n addresses the n-th line of the buffer.<br />
4. 1x addresses the line marked with the mark name character<br />
x, which must be a lower-case letter. Lines are marked with<br />
the k command described below.<br />
5. A RE enclosed by slashes (I) addresses the first line found<br />
by searching forward from the line following the current line<br />
toward the end of the buffer and stopping at the first line<br />
containing a string matching the RE. If necessary, the<br />
search wraps around to the beginning of the buffer and continues<br />
up to and including the current line, so that the<br />
entire buffer is searched. See also the last paragraph before<br />
- 3-