| 1 | .TH ED 1 9/14/79 |
| 2 | .UC |
| 3 | .if t .ds q \(aa |
| 4 | .if n .ds q ' |
| 5 | .SH NAME |
| 6 | ed \- text editor |
| 7 | .SH SYNOPSIS |
| 8 | .B ed |
| 9 | [ |
| 10 | .B \- |
| 11 | ] [ |
| 12 | .BR \-p [prompt] |
| 13 | ] [ |
| 14 | .B \-u |
| 15 | ] [ |
| 16 | .B \-x |
| 17 | ] [ name ] |
| 18 | .SH DESCRIPTION |
| 19 | .I Ed |
| 20 | is the standard text editor. |
| 21 | .PP |
| 22 | If a |
| 23 | .I name |
| 24 | argument is given, |
| 25 | .I ed |
| 26 | simulates an |
| 27 | .I e |
| 28 | command (see below)\| on the named file; that is to say, |
| 29 | the file is read into |
| 30 | .I ed's |
| 31 | buffer so that it can be edited. |
| 32 | If |
| 33 | .B \-p |
| 34 | is present, |
| 35 | .I ed |
| 36 | prompts for commands |
| 37 | with `* ' |
| 38 | (or |
| 39 | .I prompt |
| 40 | if given.) |
| 41 | If |
| 42 | .B \-u |
| 43 | is present, |
| 44 | all lower case text in the buffer |
| 45 | is converted to upper case. |
| 46 | If |
| 47 | .B \-x |
| 48 | is present, an |
| 49 | .I x |
| 50 | command is simulated first to handle an encrypted file. |
| 51 | The optional |
| 52 | .B \- |
| 53 | suppresses the printing |
| 54 | of explanatory output |
| 55 | and should be used |
| 56 | when the standard input is |
| 57 | an editor script. |
| 58 | .PP |
| 59 | .I Ed |
| 60 | operates on a copy of any file it is editing; changes made |
| 61 | in the copy have no effect on the file until a |
| 62 | .IR w "" |
| 63 | (write)\| |
| 64 | command is given. |
| 65 | The copy of the text being edited resides |
| 66 | in a temporary file called the |
| 67 | .IR buffer . |
| 68 | .PP |
| 69 | Commands to |
| 70 | .I ed |
| 71 | have a simple and regular structure: zero or |
| 72 | more |
| 73 | .I addresses |
| 74 | followed by a single character |
| 75 | .I command, |
| 76 | possibly |
| 77 | followed by parameters to the command. |
| 78 | These addresses specify one or more lines in the buffer. |
| 79 | Missing addresses are supplied by default. |
| 80 | .PP |
| 81 | In general, only one command may appear on a line. |
| 82 | Certain commands allow the |
| 83 | addition of text to the buffer. |
| 84 | While |
| 85 | .I ed |
| 86 | is accepting text, it is said |
| 87 | to be in |
| 88 | .I "input mode." |
| 89 | In this mode, no commands are recognized; |
| 90 | all input is merely collected. |
| 91 | Input mode is left by typing a period `\fB.\fR' alone at the |
| 92 | beginning of a line. |
| 93 | .PP |
| 94 | .I Ed |
| 95 | supports a limited form of |
| 96 | .I "regular expression" |
| 97 | notation. |
| 98 | A regular expression specifies |
| 99 | a set of strings of characters. |
| 100 | A member of this set of strings is said to be |
| 101 | .I matched |
| 102 | by the regular expression. |
| 103 | In the following specification for regular expressions |
| 104 | the word `character' means any character but newline. |
| 105 | .IP 1. |
| 106 | Any character except a special character |
| 107 | matches itself. |
| 108 | Special characters are |
| 109 | the regular expression delimiter plus |
| 110 | .RB \e\|[\| . |
| 111 | and sometimes ^\|*\|$. |
| 112 | .IP 2. |
| 113 | A |
| 114 | .B . |
| 115 | matches any character. |
| 116 | .IP 3. |
| 117 | A \e followed by any character except a digit or (\|) matches that character. |
| 118 | .IP 4. |
| 119 | A nonempty string |
| 120 | .I s |
| 121 | bracketed |
| 122 | .RI [ \|s\| ] |
| 123 | (or |
| 124 | .RI [^ s\| ]) |
| 125 | matches any character in (or not in) |
| 126 | .I s. |
| 127 | In |
| 128 | .I s, |
| 129 | \e has no special meaning, and ] may only appear as |
| 130 | the first letter. |
| 131 | A substring |
| 132 | .I a\-b, |
| 133 | with |
| 134 | .I a |
| 135 | and |
| 136 | .I b |
| 137 | in ascending ASCII order, stands for the inclusive |
| 138 | range of ASCII characters. |
| 139 | .IP 5. |
| 140 | A regular expression of form 1-4 followed by * matches a sequence of |
| 141 | 0 or more matches of the regular expression. |
| 142 | .IP 6. |
| 143 | A regular expression, |
| 144 | .I x, |
| 145 | of form 1-8, bracketed |
| 146 | .RI \e( \|x\| \e) |
| 147 | matches what |
| 148 | .I x |
| 149 | matches. |
| 150 | .IP 7. |
| 151 | A \e followed by a digit |
| 152 | .I n |
| 153 | matches a copy of the string that the |
| 154 | bracketed regular expression beginning with the |
| 155 | .IR n th |
| 156 | \e( matched. |
| 157 | .IP 8. |
| 158 | A regular expression of form 1-8, |
| 159 | .I x, |
| 160 | followed by a regular expression of form 1-7, |
| 161 | .I y |
| 162 | matches a match for |
| 163 | .I x |
| 164 | followed by a match for |
| 165 | .I y, |
| 166 | with the |
| 167 | .I x |
| 168 | match being as long as possible while still permitting a |
| 169 | .I y |
| 170 | match. |
| 171 | .IP 9. |
| 172 | A regular expression of form 1-8 preceded by ^ |
| 173 | (or followed by $), is constrained to matches that |
| 174 | begin at the left (or end at the right) end of a line. |
| 175 | .IP 10. |
| 176 | A regular expression of form 1-9 picks out the |
| 177 | longest among the leftmost matches in a line. |
| 178 | .IP 11. |
| 179 | An empty regular expression stands for a copy of the |
| 180 | last regular expression encountered. |
| 181 | .PP |
| 182 | Regular expressions are used in addresses to specify |
| 183 | lines and in one command |
| 184 | (see |
| 185 | .I s |
| 186 | below)\| |
| 187 | to specify a portion of a line which is to be replaced. |
| 188 | If it is desired to use one of |
| 189 | the regular expression metacharacters as an ordinary |
| 190 | character, that character may be preceded by `\e'. |
| 191 | This also applies to the character bounding the regular |
| 192 | expression (often `/')\| and to `\e' itself. |
| 193 | .PP |
| 194 | To understand addressing in |
| 195 | .I ed |
| 196 | it is necessary to know that at any time there is a |
| 197 | .I "current line." |
| 198 | Generally speaking, the current line is |
| 199 | the last line affected by a command; however, |
| 200 | the exact effect on the current line |
| 201 | is discussed under the description of |
| 202 | the command. |
| 203 | Addresses are constructed as follows. |
| 204 | .TP |
| 205 | 1. |
| 206 | The character `\fB.\fR' addresses the current line. |
| 207 | .TP |
| 208 | 2. |
| 209 | The character `$' addresses the last line of the buffer. |
| 210 | .TP |
| 211 | 3. |
| 212 | A decimal number |
| 213 | .I n |
| 214 | addresses the |
| 215 | .IR n -th |
| 216 | line of the buffer. |
| 217 | .TP |
| 218 | 4. |
| 219 | `\(fm\fIx\fR' addresses the line marked with the name |
| 220 | .IR x , |
| 221 | which must be a lower-case letter. |
| 222 | Lines are marked with the |
| 223 | .I k |
| 224 | command described below. |
| 225 | .TP |
| 226 | 5. |
| 227 | A regular expression enclosed in slashes `/' addresses |
| 228 | the line found by searching forward from the current line |
| 229 | and stopping at the first line containing a |
| 230 | string that matches the regular expression. |
| 231 | If necessary the search wraps around to the beginning of the |
| 232 | buffer. |
| 233 | .TP |
| 234 | 6. |
| 235 | A regular expression enclosed in queries `?' addresses |
| 236 | the line found by searching backward from the current line |
| 237 | and stopping at the first line containing |
| 238 | a string that matches the regular expression. |
| 239 | If necessary |
| 240 | the search wraps around to the end of the buffer. |
| 241 | .TP |
| 242 | 7. |
| 243 | An address followed by a plus sign `+' |
| 244 | or a minus sign `\-' followed by a decimal number specifies that address plus |
| 245 | (resp. minus)\| the indicated number of lines. |
| 246 | The plus sign may be omitted. |
| 247 | .TP |
| 248 | 8. |
| 249 | If an address begins with `+' or `\-' |
| 250 | the addition or subtraction is taken with respect to the current line; |
| 251 | e.g. `\-5' is understood to mean `\fB.\fR\-5'. |
| 252 | .TP |
| 253 | 9. |
| 254 | If an address ends with `+' or `\-', |
| 255 | then 1 is added (resp. subtracted). |
| 256 | As a consequence of this rule and rule 8, |
| 257 | the address `\-' refers to the line before the current line. |
| 258 | Moreover, |
| 259 | trailing |
| 260 | `+' and `\-' characters |
| 261 | have cumulative effect, so `\-\-' refers to the current |
| 262 | line less 2. |
| 263 | .TP |
| 264 | 10. |
| 265 | To maintain compatibility with earlier versions of the editor, |
| 266 | the character `^' in addresses is |
| 267 | equivalent to `\-'. |
| 268 | .PP |
| 269 | Commands may require zero, one, or two addresses. |
| 270 | Commands which require no addresses regard the presence |
| 271 | of an address as an error. |
| 272 | Commands which accept one or two addresses |
| 273 | assume default addresses when insufficient are given. |
| 274 | If more addresses are given than such a command requires, |
| 275 | the last one or two (depending on what is accepted)\| are used. |
| 276 | .PP |
| 277 | Addresses are separated from each other typically by a comma |
| 278 | `\fB,\fR'. |
| 279 | They may also be separated by a semicolon |
| 280 | `\fB;\fR'. |
| 281 | In this case the current line `\fB.\fR' is set to |
| 282 | the previous address before the next address is interpreted. |
| 283 | This feature can be used to determine the starting |
| 284 | line for forward and backward searches (`/', `?')\|. |
| 285 | The second address of any two-address sequence |
| 286 | must correspond to a line following the line corresponding to the first address. |
| 287 | The special form `%' |
| 288 | is an abbreviation for the address pair `1,$'. |
| 289 | .PP |
| 290 | In the following list of |
| 291 | .I ed |
| 292 | commands, the default addresses |
| 293 | are shown in parentheses. |
| 294 | The parentheses are not part of |
| 295 | the address, but are used to show that the given addresses are |
| 296 | the default. |
| 297 | .PP |
| 298 | As mentioned, it is generally illegal for more than one |
| 299 | command to appear on a line. |
| 300 | However, most commands may be suffixed by `p' |
| 301 | or by `l', in which case |
| 302 | the current line is either |
| 303 | printed or listed respectively |
| 304 | in the way discussed below. |
| 305 | Commands may also be suffixed by `n', |
| 306 | meaning the output of the command is to |
| 307 | be line numbered. |
| 308 | These suffixes may be combined in any order. |
| 309 | .TP 5 |
| 310 | .RB (\| .\| )\|a |
| 311 | .br |
| 312 | .ns |
| 313 | .TP 5 |
| 314 | <text> |
| 315 | .br |
| 316 | .ns |
| 317 | .TP 5 |
| 318 | .B . |
| 319 | .br |
| 320 | The append command reads the given text |
| 321 | and appends it after the addressed line. |
| 322 | `\fB.\fR' is left |
| 323 | on the last line input, if there |
| 324 | were any, otherwise at the addressed line. |
| 325 | Address `0' is legal for this command; text is placed |
| 326 | at the beginning of the buffer. |
| 327 | .TP 5 |
| 328 | .RB (\| .\| ,\ .\| )\|c |
| 329 | .br |
| 330 | .ns |
| 331 | .TP 5 |
| 332 | <text> |
| 333 | .br |
| 334 | .ns |
| 335 | .TP 5 |
| 336 | .B . |
| 337 | .br |
| 338 | The change |
| 339 | command deletes the addressed lines, then accepts input |
| 340 | text which replaces these lines. |
| 341 | `\fB.\fR' is left at the last line input; if there were none, |
| 342 | it is left at the line preceding the deleted lines. |
| 343 | .TP 5 |
| 344 | .RB (\| .\| ,\ .\| )\|d |
| 345 | The delete command deletes the addressed lines from the buffer. |
| 346 | The line originally after the last line deleted becomes the current line; |
| 347 | if the lines deleted were originally at the end, |
| 348 | the new last line becomes the current line. |
| 349 | .TP 5 |
| 350 | e filename |
| 351 | The edit |
| 352 | command causes the entire contents of the buffer to be deleted, |
| 353 | and then the named file to be read in. |
| 354 | `\fB.\fR' is set to the last line of the buffer. |
| 355 | The number of characters read is typed. |
| 356 | `filename' is remembered for possible use as a default file name |
| 357 | in a subsequent |
| 358 | .I r |
| 359 | or |
| 360 | .I w |
| 361 | command. |
| 362 | If `filename' is missing, the remembered name is used. |
| 363 | .TP 5 |
| 364 | E filename |
| 365 | This command is the same as |
| 366 | .I e, |
| 367 | except that no diagnostic results when no |
| 368 | .I w |
| 369 | has been given since the last buffer alteration. |
| 370 | .TP 5 |
| 371 | f filename |
| 372 | The filename command prints the currently remembered file name. |
| 373 | If `filename' is given, |
| 374 | the currently remembered file name is changed to `filename'. |
| 375 | .TP 5 |
| 376 | (1,$)\|g/regular expression/command list |
| 377 | In the global |
| 378 | command, the first step is to mark every line which matches |
| 379 | the given regular expression. |
| 380 | Then for every such line, the |
| 381 | given command list is executed with `\fB.\fR' initially set to that line. |
| 382 | A single command or the first of multiple commands |
| 383 | appears on the same line with the global command. |
| 384 | All lines of a multi-line list except the last line must be ended with `\e'. |
| 385 | .I A, |
| 386 | .I i, |
| 387 | and |
| 388 | .I c |
| 389 | commands and associated input are permitted; |
| 390 | the `\fB.\fR' terminating input mode may be omitted if it would be on the |
| 391 | last line of the command list. |
| 392 | The commands |
| 393 | .I g |
| 394 | and |
| 395 | .I v |
| 396 | are not permitted in the command list. |
| 397 | .TP 5 |
| 398 | .RB (\| .\| )\|i |
| 399 | .ns |
| 400 | .TP 5 |
| 401 | <text> |
| 402 | .br |
| 403 | .ns |
| 404 | .TP 5 |
| 405 | .B . |
| 406 | .br |
| 407 | This command inserts the given text before the addressed line. |
| 408 | `\fB.\fR' is left at the last line input, or, if there were none, |
| 409 | at the line before the addressed line. |
| 410 | This command differs from the |
| 411 | .I a |
| 412 | command only in the placement of the |
| 413 | text. |
| 414 | .TP 5 |
| 415 | .RB (\| .\| ,\ . +1)\|j |
| 416 | This command joins the addressed lines into a single line; |
| 417 | intermediate newlines simply disappear. |
| 418 | `\fB.\fR' is left at the resulting line. |
| 419 | .TP 5 |
| 420 | ( \fB. \fR)\|k\fIx\fR |
| 421 | The mark command marks the addressed line with |
| 422 | name |
| 423 | .I x, |
| 424 | which must be a lower-case letter. |
| 425 | The address form `\(fm\fIx\fR' then addresses this line. |
| 426 | .ne 2.5 |
| 427 | .TP 5 |
| 428 | .RB (\| .\| ,\ .\| )\|l |
| 429 | The list command |
| 430 | prints the addressed lines in an unambiguous way: |
| 431 | non-graphic characters are |
| 432 | printed in two-digit octal, |
| 433 | and long lines are folded. |
| 434 | The |
| 435 | .I l |
| 436 | command may be placed on the same line after any non-i/o |
| 437 | command. |
| 438 | .TP 5 |
| 439 | .RB (\| .\| ,\ .\| )\|m\fIa |
| 440 | The move command repositions the addressed lines after the line |
| 441 | addressed by |
| 442 | .IR a . |
| 443 | The last of the moved lines becomes the current line. |
| 444 | .TP 5 |
| 445 | .RB (\| .\| ,\ .\| )\|n |
| 446 | The number command prints the addressed lines |
| 447 | with line numbers and a tab at the left. |
| 448 | .TP 5 |
| 449 | .RB (\| .\| ,\ .\| )\|p |
| 450 | The print command prints the addressed lines. |
| 451 | `\fB.\fR' |
| 452 | is left at the last line printed. |
| 453 | The |
| 454 | .I p |
| 455 | command |
| 456 | may |
| 457 | be placed on the same line after any non-i/o command. |
| 458 | .TP |
| 459 | .RB (\| .\| ,\ .\| )\|P |
| 460 | This command is a synonym for |
| 461 | .I p. |
| 462 | .TP 5 |
| 463 | q |
| 464 | The quit command causes |
| 465 | .I ed |
| 466 | to exit. |
| 467 | No automatic write |
| 468 | of a file is done. |
| 469 | .TP 5 |
| 470 | Q |
| 471 | This command is the same as |
| 472 | .I q, |
| 473 | except that no diagnostic results when no |
| 474 | .I w |
| 475 | has been given since the last buffer alteration. |
| 476 | .TP 5 |
| 477 | ($)\|r filename |
| 478 | The read command |
| 479 | reads in the given file after the addressed line. |
| 480 | If no file name is given, |
| 481 | the remembered file name, if any, is used |
| 482 | (see |
| 483 | .I e |
| 484 | and |
| 485 | .I f |
| 486 | commands)\|. |
| 487 | The file name is remembered if there was no |
| 488 | remembered file name already. |
| 489 | Address `0' is legal for |
| 490 | .I r |
| 491 | and causes the |
| 492 | file to be read at the beginning of the buffer. |
| 493 | If the read is successful, the number of characters |
| 494 | read is typed. |
| 495 | `\fB.\fR' is left at the last line read in from the file. |
| 496 | .TP 5 |
| 497 | (\| \fB.\fR\|, \fB.\fR\|)\|s/regular expression/replacement/ or, |
| 498 | .br |
| 499 | .ns |
| 500 | .TP 5 |
| 501 | (\| \fB.\fR\|, \fB.\fR\|)\|s/regular expression/replacement/g |
| 502 | The substitute command searches each addressed |
| 503 | line for an occurrence of the specified regular expression. |
| 504 | On each line in which a match is found, |
| 505 | all matched strings are replaced by the replacement specified, |
| 506 | if the global replacement indicator `g' appears after the command. |
| 507 | If the global indicator does not appear, only the first occurrence |
| 508 | of the matched string is replaced. |
| 509 | It is an error for the substitution to fail on all addressed lines. |
| 510 | Any punctuation character |
| 511 | may be used instead of `/' to delimit the regular expression |
| 512 | and the replacement. |
| 513 | `\fB.\fR' is left at the last line substituted. |
| 514 | .IP |
| 515 | An ampersand `&' appearing in the replacement |
| 516 | is replaced by the string matching the regular expression. |
| 517 | The special meaning of `&' in this context may be |
| 518 | suppressed by preceding it by `\e'. |
| 519 | The characters |
| 520 | .I `\|\en' |
| 521 | where |
| 522 | .I n |
| 523 | is a digit, |
| 524 | are replaced by the text matched by the |
| 525 | .IR n -th |
| 526 | regular subexpression |
| 527 | enclosed between `\e(' and `\e)'. |
| 528 | When |
| 529 | nested, parenthesized subexpressions |
| 530 | are present, |
| 531 | .I n |
| 532 | is determined by counting occurrences of `\e(' starting from the left. |
| 533 | .IP |
| 534 | Lines may be split by substituting new-line characters into them. |
| 535 | The new-line in the |
| 536 | replacement string |
| 537 | must be escaped by preceding it by `\e'. |
| 538 | .IP |
| 539 | One or two trailing delimiters may be omitted, |
| 540 | implying the `p' suffix. |
| 541 | The special form `s' followed by |
| 542 | .I no |
| 543 | delimiters |
| 544 | repeats the most recent substitute command |
| 545 | on the addressed lines. |
| 546 | The `s' may be followed by the letters |
| 547 | .B r |
| 548 | (use the most recent regular expression for the |
| 549 | left hand side, instead of the most recent |
| 550 | left hand side of a substitute command), |
| 551 | .B p |
| 552 | (complement the setting of the |
| 553 | .I p |
| 554 | suffix from the previous substitution), or |
| 555 | .B g |
| 556 | (complement the setting of the |
| 557 | .I g |
| 558 | suffix). |
| 559 | These letters may be combined in any order. |
| 560 | .TP 5 |
| 561 | .RB (\| .\| ,\ .\| )\|t\|\fIa |
| 562 | This command acts just like the |
| 563 | .I m |
| 564 | command, except that a copy of the addressed lines is placed |
| 565 | after address |
| 566 | .I a |
| 567 | (which may be 0). |
| 568 | `\fB.\fR' is left on the last line of the copy. |
| 569 | .TP 5 |
| 570 | .RB (\| .\| ,\ .\| )\|u |
| 571 | The undo command restores the buffer to it's state |
| 572 | before the most recent buffer modifying command. |
| 573 | The current line is also restored. |
| 574 | Buffer modifying commands are |
| 575 | .I a, c, d, g, i, k, m, r, s, t, |
| 576 | and |
| 577 | .I v. |
| 578 | For purposes of undo, |
| 579 | .I g |
| 580 | and |
| 581 | .I v |
| 582 | are considered to be a single buffer modifying command. |
| 583 | Undo is its own inverse. |
| 584 | .IP |
| 585 | When |
| 586 | .I ed |
| 587 | runs out of memory |
| 588 | (at about 8000 lines on any 16 bit mini-computer |
| 589 | such as the PDP-11) |
| 590 | This full undo is not possible, and |
| 591 | .I u |
| 592 | can only undo the effect of the most recent |
| 593 | substitute on the current line. |
| 594 | This restricted undo also applies to editor scripts |
| 595 | when |
| 596 | .I ed |
| 597 | is invoked with the |
| 598 | .B - |
| 599 | option. |
| 600 | .TP 5 |
| 601 | (1, $)\|v/regular expression/command list |
| 602 | This command is the same as the global command |
| 603 | .I g |
| 604 | except that the command list is executed |
| 605 | .I g |
| 606 | with `\fB.\fR' initially set to every line |
| 607 | .I except |
| 608 | those |
| 609 | matching the regular expression. |
| 610 | .TP 5 |
| 611 | (1, $)\|w filename |
| 612 | .br |
| 613 | The write command writes the addressed lines onto |
| 614 | the given file. |
| 615 | If the file does not exist, |
| 616 | it is created. |
| 617 | The file name is remembered if there was no |
| 618 | remembered file name already. |
| 619 | If no file name is given, |
| 620 | the remembered file name, if any, is used |
| 621 | (see |
| 622 | .I e |
| 623 | and |
| 624 | .I f |
| 625 | commands)\|. |
| 626 | `\fB.\fR' is unchanged. |
| 627 | If the command is successful, the number of characters written is |
| 628 | printed. |
| 629 | .TP |
| 630 | (1, $)\|W filename |
| 631 | This command is the same as |
| 632 | .I w, |
| 633 | except that the addressed lines are appended to the file. |
| 634 | .TP 5 |
| 635 | (1, $)\|wq filename |
| 636 | This command is the same as |
| 637 | .I w |
| 638 | except that afterwards a |
| 639 | .I q |
| 640 | command is done, |
| 641 | exiting the editor |
| 642 | after the file is written. |
| 643 | .TP 5 |
| 644 | x |
| 645 | A key string is demanded from the standard input. |
| 646 | Later |
| 647 | .I r, e |
| 648 | and |
| 649 | .I w |
| 650 | commands will encrypt and decrypt the text |
| 651 | with this key by the algorithm of |
| 652 | .IR crypt (1). |
| 653 | An explicitly empty key turns off encryption. |
| 654 | .RB (\| .\| +1)\|z or, |
| 655 | .br |
| 656 | .ns |
| 657 | .TP 5 |
| 658 | .RB (\| .\| +1)\|z\fIn |
| 659 | This command scrolls through the buffer starting at the addressed line. |
| 660 | 22 (or |
| 661 | .I n, |
| 662 | if given) |
| 663 | lines are printed. |
| 664 | The last line printed becomes the current line. |
| 665 | The value |
| 666 | .I n |
| 667 | is sticky, in that it becomes the default for |
| 668 | future |
| 669 | .I z |
| 670 | commands. |
| 671 | .TP 5 |
| 672 | ($)\|= |
| 673 | The line number of the addressed line is typed. |
| 674 | `\fB.\fR' is unchanged by this command. |
| 675 | .TP 5 |
| 676 | !<shell command> |
| 677 | The remainder of the line after the `!' is sent |
| 678 | to |
| 679 | .IR sh (1) |
| 680 | to be interpreted as a command. |
| 681 | .RB ` . ' |
| 682 | is unchanged. |
| 683 | .TP 5 |
| 684 | .RB (\| . +1,\| . +1)\|<newline> |
| 685 | An address alone on a line causes the addressed line to be printed. |
| 686 | A blank line alone is equivalent to `.+1p'; it is useful |
| 687 | for stepping through text. |
| 688 | If two addresses are present with no |
| 689 | intervening semicolon, |
| 690 | .I ed |
| 691 | prints the range of lines. |
| 692 | If they are separated by a semicolon, |
| 693 | the second line is printed. |
| 694 | .PP |
| 695 | If an interrupt signal (ASCII DEL)\| is sent, |
| 696 | .I ed |
| 697 | prints `?interrupted' |
| 698 | and returns to its command level. |
| 699 | .PP |
| 700 | Some size limitations: |
| 701 | 512 characters per line, |
| 702 | 256 characters per global command list, |
| 703 | 64 characters per file name, |
| 704 | and, on mini computers, |
| 705 | 128K characters in the temporary file. |
| 706 | The limit on the number of lines depends on the amount of core: |
| 707 | each line takes 2 words. |
| 708 | .PP |
| 709 | When reading a file, |
| 710 | .I ed |
| 711 | discards ASCII NUL characters |
| 712 | and all characters after the last newline. |
| 713 | It refuses to read files containing non-ASCII characters. |
| 714 | .SH FILES |
| 715 | /tmp/e* |
| 716 | .br |
| 717 | edhup: work is saved here if terminal hangs up |
| 718 | .SH "SEE ALSO" |
| 719 | B. W. Kernighan, |
| 720 | .I |
| 721 | A Tutorial Introduction to the ED Text Editor |
| 722 | .br |
| 723 | B. W. Kernighan, |
| 724 | .I Advanced editing on UNIX |
| 725 | .br |
| 726 | sed(1), crypt(1) |
| 727 | .SH DIAGNOSTICS |
| 728 | `?name' for inaccessible file; |
| 729 | `?self-explanitory message' |
| 730 | for other errors. |
| 731 | .PP |
| 732 | To protect against throwing away valuable work, |
| 733 | a |
| 734 | .I q |
| 735 | or |
| 736 | .I e |
| 737 | command is considered to be in error, unless a |
| 738 | .I w |
| 739 | has occurred since the last buffer change. |
| 740 | A second |
| 741 | .I q |
| 742 | or |
| 743 | .I e |
| 744 | will be obeyed regardless. |
| 745 | .SH BUGS |
| 746 | The |
| 747 | .I l |
| 748 | command mishandles DEL. |
| 749 | .br |
| 750 | The |
| 751 | .I undo |
| 752 | command causes marks to be lost on affected lines. |
| 753 | .br |
| 754 | The |
| 755 | .I x |
| 756 | command, |
| 757 | .B -x |
| 758 | option, |
| 759 | and |
| 760 | special treatment of hangups |
| 761 | only work on UNIX. |