|
|
1.1 ! root 1: .ds v 7.15 ! 2: .nr sa 35 ! 3: .ds ex edt ! 4: .ds ed xed ! 5: .ds Ed Xed ! 6: .ds ED XED ! 7: .ds ux eXtended ! 8: '''.ds ed eed ! 9: '''.ds Ed Eed ! 10: '''.ds ED EED ! 11: '''.ds ux EE/unix ! 12: .if t .ds 0 \o'/0' ! 13: .if t .ds oq "`` ! 14: .if t .ds cq "'' ! 15: .if n .ds oq "" ! 16: .if n .ds cq "" ! 17: .nh ! 18: .TH \*(ED 1 "28 July 1983" ! 19: .UC 4 ! 20: .SH NAME ! 21: \*(ed ! 22: \(mi \*(ux text EDitor \(mi V\*v ! 23: .SH SYNOPSIS ! 24: .B \*(ed ! 25: [ ! 26: .B \(mi!@abBcdefhiklmnoOpqrstvwy ! 27: ] [ name ] ! 28: .SH DESCRIPTION ! 29: .I \*(Ed ! 30: is the \*(ux text EDitor. ! 31: .PP ! 32: If a ! 33: .I name ! 34: argument is given, ! 35: .I \*(ed ! 36: simulates an ! 37: .B e ! 38: command (see below) on the named file; that is to say, ! 39: the file is read into ! 40: .IR \*(ed 's ! 41: buffer so that it can be edited. ! 42: After every \n(sa ! 43: (default) ! 44: commands have been executed, ! 45: the edit buffer will be written ! 46: on a scratch file. ! 47: When ! 48: .I \*(ed ! 49: terminates successfully, ! 50: the ! 51: .I save ! 52: file will be removed unless the ! 53: .B \(mid ! 54: flag was selected. ! 55: If a writeable file named \*(oq\c ! 56: .I edsav\c ! 57: \&\*(cq exists in the current directory, ! 58: all commands typed will be written to it. ! 59: .PP ! 60: The optional flags after the ! 61: .B \(mi ! 62: have the following functions: ! 63: .TP ! 64: .B \(mi! ! 65: Disallow use of the ! 66: .B ! ! 67: command. ! 68: Mostly useful for writing programs which cannot allow ! 69: unrestricted access to shell commands. ! 70: .TP ! 71: .BI \(mi@ fn ! 72: Preset the ! 73: .I indirect ! 74: file name to ! 75: .IR fn . ! 76: Subsequent use of the ! 77: .B @ ! 78: command will read commands from ! 79: .IR fn , ! 80: until the name is changed by giving an argument to the ! 81: .B @ ! 82: command. ! 83: .TP ! 84: .B \(mia ! 85: The line numbers will be printed in ! 86: .I apl ! 87: mode. ! 88: The form is ! 89: \*(oq[ ! 90: .I n ! 91: ]\fI\et\fP\*(cq ! 92: followed by the text. ! 93: In addition, ! 94: overstruck characters will be printed ! 95: on two lines, one above the other. ! 96: .I Apl ! 97: line numbers begin at ! 98: .I zero ! 99: instead of one. ! 100: .TP ! 101: .B \(mib ! 102: Make a ! 103: .I backup ! 104: copy of the edit file ! 105: upon entry to the editor. ! 106: The file's name will be that of the original ! 107: file with a \*(oq\c ! 108: .BI . bak\c ! 109: \&\*(cq extension. ! 110: .TP ! 111: .BI \(miB nnnn ! 112: Set the ! 113: .I line ! 114: buffer size to ! 115: .I nnnn ! 116: (decimal) bytes. ! 117: The default line buffer size is 512 bytes, ! 118: which limits the maximum length line which may be processed. ! 119: Since there are occasions where it is desired to process ! 120: longer lines, ! 121: the buffer size may be increased. ! 122: .TP ! 123: .BI \(mic nn ! 124: Set the editor's idea of the depth of the Crt screen ! 125: for the ! 126: .B : ! 127: command to ! 128: .I nn ! 129: (decimal). ! 130: Default is 21 lines. ! 131: If ! 132: .I nn ! 133: is zero, the paging will be disabled. ! 134: (See also the ! 135: .I d=nn ! 136: command.) ! 137: .TP ! 138: .B \(mid ! 139: Disables the deletion of the file created via the ! 140: .I auto-save ! 141: feature. ! 142: (The \*(oq\c ! 143: .BI . \*(ex\c ! 144: \&\*(cq file.) ! 145: .TP ! 146: .B \(mie ! 147: Each input command will be echoed on standard output. ! 148: This is useful for debugging editor command files, ! 149: since the error message will be immediately ! 150: preceded by the command that caused it. ! 151: .TP ! 152: .B \(mif ! 153: .I \*(Ed ! 154: will automatically prompt for text lines ! 155: upon being invoked. ! 156: Upon exit, ! 157: .I \*(ed ! 158: will automatically write the file. ! 159: This is useful for creating files without having to type the ! 160: .B a ! 161: command upon entry. ! 162: Note: If this flag is selected, the editor will over-write ! 163: an existing file by the same name. ! 164: See the ! 165: .B qi ! 166: command. ! 167: .TP ! 168: .B \(mih ! 169: Enable processing of a \*(oq\c ! 170: .I huge\c ! 171: \&\*(cq file, I.E. one with ! 172: up to 511 blocks, instead of the normal limit ! 173: of 255 blocks. ! 174: The use of ! 175: .B \(mih ! 176: disallows the ! 177: .B g ! 178: and ! 179: .B v ! 180: commands. ! 181: (This flag is inoperative and unnecessary on the Vax.) ! 182: .TP ! 183: .B \(mii ! 184: If an ! 185: .I interrupt ! 186: (ASCII ! 187: .BR DEL ) ! 188: character is typed, ! 189: .I \*(ed ! 190: will write the current contents of the edit buffer on a file, ! 191: and exit. ! 192: The name of the dump file is that of the original file with a ! 193: .BI . int ! 194: extension. ! 195: The ! 196: .B \(mii ! 197: flag is very useful for shell files ! 198: which call the editor, since the editor will ! 199: not hang around after an interrupt, ! 200: interfering with the user's commands. ! 201: .TP ! 202: .B \(mik ! 203: Useful for slow terminals, ! 204: this flag ! 205: .I kills ! 206: verbose error messages. ! 207: Instead, ! 208: .I \*(ed ! 209: prints a query ! 210: .B ? ! 211: followed by an ! 212: .IR "error number" . ! 213: The actual error message may be obtained by typing the ! 214: .BI e nn ! 215: command (see below). ! 216: The long error messages may be turned on/off ! 217: via the ! 218: .B e+ ! 219: and ! 220: .B e\(mi ! 221: commands (see below). ! 222: .TP ! 223: .BI \(mil c ! 224: The ! 225: .I eol ! 226: character is initialized to character ! 227: .IR c . ! 228: It may be changed during the edit session by the ! 229: .BI e= c ! 230: command. ! 231: .TP ! 232: .BI \(mim nn ! 233: The modification count before an automatic ! 234: save of the edit buffer is set to ! 235: .I nn ! 236: (decimal). ! 237: Default is \n(sa. ! 238: (That is, after every \n(sa commands which cause ! 239: a modification to one or more lines, the ! 240: edit buffer will be written on the edit ! 241: file name with ! 242: .BI . \*(ex ! 243: extension.) ! 244: If the count is zero, the auto-save feature is disabled. ! 245: .TP ! 246: .B \(min ! 247: The ! 248: .I no-line-numbers ! 249: flag is toggled. ! 250: This results in the omission of line number prompts ! 251: as well as line numbers on the ! 252: .B p ! 253: and ! 254: .B l ! 255: commands. ! 256: .TP ! 257: .B \(mio ! 258: The editor will not seek standard input to end-of-file ! 259: upon detecting a command error. ! 260: Normally, this results in a command file terminating immediately. ! 261: .TP ! 262: .B \(miO ! 263: If a ! 264: .I write ! 265: is attempted to a file that is write-locked, ! 266: but is owned by the user, ! 267: an attempt will be made to ! 268: .I override ! 269: the permission. ! 270: .TP ! 271: .B \(mip ! 272: Turn on prompts even if not talking to a terminal, mostly ! 273: useful for editing through pipes ! 274: (as when using ! 275: .IR protocol (1) ! 276: or ! 277: .IR script (1)). ! 278: .TP ! 279: .B \(miq ! 280: The editor will ! 281: .B NOT ! 282: ignore a ! 283: .I quit ! 284: (ASCII ! 285: .B FS ! 286: or ctrl-\c ! 287: .B \e\c ! 288: ) signal. ! 289: Normally for editor debugging purposes, as a core dump ! 290: can then be made. ! 291: .br ! 292: .BR Beware , ! 293: the edit buffer can not be recovered! ! 294: .TP ! 295: .B \(mir ! 296: .I Removes ! 297: the special meaning of the special characters: ! 298: .B $ ! 299: .B & ! 300: .B \e( ! 301: .B \e) ! 302: .B [ ! 303: .B . ! 304: .B * ! 305: .B ^ ! 306: .B \e ! 307: .TP ! 308: .B \(mis ! 309: .I Silent ! 310: mode. ! 311: No prompts are issued, ! 312: printing of lines resulting from commands is suppressed ! 313: unless they are ! 314: .I explicitly ! 315: terminated with a ! 316: .BR p . ! 317: This mode is useful for running editor command files. ! 318: .TP ! 319: .BI \(mit c ! 320: Set the ! 321: .I tab ! 322: character to ! 323: .IR c . ! 324: This is the character which will be expanded ! 325: to the appropriate number of fill characters to get ! 326: to the next column which has a tab stop set in it. ! 327: The ! 328: .I tab ! 329: character may be set/changed using the ! 330: .BI t= c ! 331: command. ! 332: .TP ! 333: .BI \(miv c ! 334: Set the tab ! 335: .I fill ! 336: character to ! 337: .IR c . ! 338: This character is used to pad out the space between expanded ! 339: fields. ! 340: The tab ! 341: .I fill ! 342: character may be set/changed by the ! 343: .BI f= c ! 344: command. ! 345: .TP ! 346: .BI \(miw nn ! 347: Set the editor's idea of the page width to ! 348: .I nn ! 349: (decimal). ! 350: Default is 80 columns. ! 351: (See also the ! 352: .BI w= nn ! 353: command.) ! 354: .TP ! 355: .B \(miy ! 356: Set the interrupt processing to list out ! 357: one page ! 358: (see the ! 359: .B : ! 360: command) ! 361: upon receipt of an interrupt. ! 362: .TP ! 363: .B \(mi\*0123456789 ! 364: A decimal number preceded by a ! 365: .B \(mi ! 366: will set a ! 367: .I tab ! 368: stop in that column. ! 369: Tab settings may be made during edit session by the ! 370: .BI t, nn ! 371: command. ! 372: .TP ! 373: .B \(mi, ! 374: A comma in the flag list is ignored to facilitate ! 375: setting multiple tab stops. ! 376: For example, tabs may be set by any of the forms ! 377: \*(oq\(mi9\ \(mi17\ \(mi25\*(cq, \*(oq\(mi9,17,25\*(cq, \*(oq\(mi9a17d25f\*(cq. ! 378: .PP ! 379: .I \*(Ed ! 380: operates on a copy of any file it is editing; changes made ! 381: in the copy have no effect on the file until a ! 382: .I w ! 383: (write) ! 384: command is given. ! 385: The copy of the text being edited resides ! 386: in a temporary file called the buffer. ! 387: There is only one buffer. ! 388: .PP ! 389: Commands to ! 390: .I \*(ed ! 391: have a simple and regular structure: ! 392: zero or more addresses followed by a one or more character ! 393: command, possibly followed by parameters to the command. ! 394: These addresses specify one or more lines in the buffer. ! 395: Every command which requires addresses has default addresses, ! 396: so that the addresses can often be omitted. ! 397: .PP ! 398: In general, only one command may appear on a line. ! 399: (See the ! 400: .BI e= c ! 401: command and the ! 402: .B \(mil ! 403: flag.) ! 404: Certain commands allow the input of text. ! 405: This text is placed in the appropriate place in the buffer. ! 406: While ! 407: .I \*(ed ! 408: is accepting text, it is said to be in ! 409: .IR "input mode" . ! 410: In this mode, no commands are recognized; ! 411: all input is merely collected. ! 412: Input mode is left by typing a period ! 413: .B . ! 414: alone at the ! 415: beginning of a line, or by receipt of an end-of-file ! 416: (Ctrl-D) ! 417: from the keyboard. ! 418: .PP ! 419: .I \*(Ed ! 420: supports a limited form of ! 421: .I "regular expression" ! 422: notation. ! 423: A regular expression specifies ! 424: a set of strings of characters. ! 425: A member of this set of strings is said to be ! 426: .I matched ! 427: by the regular expression. ! 428: The regular expressions allowed by ! 429: .I \*(ed ! 430: are constructed as follows: ! 431: In the following specification for regular expressions ! 432: the word ! 433: .I character ! 434: means any character but newline. ! 435: .IP 1. ! 436: Any character except a ! 437: .I special ! 438: character ! 439: matches itself. ! 440: Special characters are ! 441: the regular expression delimiter plus ! 442: .B "\e [ ." ! 443: and sometimes ! 444: .BR "^ * $" . ! 445: .IP 2. ! 446: A ! 447: .B . ! 448: matches any character. ! 449: .IP 3. ! 450: A ! 451: .B \e ! 452: followed by any character except a ! 453: .I digit ! 454: or ! 455: .B "( )" ! 456: matches that character. ! 457: .IP 4. ! 458: A nonempty string ! 459: .I s ! 460: bracketed ! 461: .B [\c ! 462: .I s\c ! 463: .B ] ! 464: (or ! 465: .B [^\c ! 466: .I s\c ! 467: .BR ] ) ! 468: matches any character in (or not in) ! 469: .IR s . ! 470: In ! 471: .IR s , ! 472: .B \e ! 473: has no special meaning, and ! 474: .B ] ! 475: may only appear as ! 476: the first letter. ! 477: A substring ! 478: .I a\c ! 479: \(mi\c ! 480: .IR b , ! 481: with ! 482: .I a ! 483: and ! 484: .I b ! 485: in ascending ASCII order, stands for the inclusive ! 486: range of ASCII characters. ! 487: .IP 5. ! 488: A regular expression of form 1-4 followed by ! 489: .B * ! 490: matches a sequence of ! 491: .I zero ! 492: or more matches of the regular expression. ! 493: .IP 6. ! 494: A regular expression, ! 495: .IR x , ! 496: of form 1-8, bracketed ! 497: .B \e(\c ! 498: .I x\c ! 499: .B \e) ! 500: matches what ! 501: .I x ! 502: matches, with side-effects described under the ! 503: .B s ! 504: command below. ! 505: .IP 7. ! 506: A ! 507: .B \e ! 508: followed by a digit ! 509: .I n ! 510: matches a copy of the string that the ! 511: bracketed regular expression beginning with the ! 512: .IR n th ! 513: .B \e( ! 514: matched. ! 515: .IP 8. ! 516: A regular expression of form 1-8, ! 517: .IR x , ! 518: followed by a regular expression of form 1-7, ! 519: .I y ! 520: matches a match for ! 521: .I x ! 522: followed by a match for ! 523: .IR y , ! 524: with the ! 525: .I x ! 526: match being as long as possible while still permitting a ! 527: .I y ! 528: match. ! 529: .IP 9. ! 530: A regular expression of form 1-8 preceded by ! 531: .B ^ ! 532: (or followed by ! 533: .BR $ ), ! 534: is constrained to matches that ! 535: begin at the left (or end at the right) end of a line. ! 536: .IP 10. ! 537: A regular expression of form 1-9 picks out the ! 538: longest among the leftmost matches in a line. ! 539: .IP 11. ! 540: An empty regular expression stands for a copy of the ! 541: last regular expression encountered. ! 542: .PP ! 543: Regular expressions are used in addresses to specify ! 544: lines and in one command ! 545: (see ! 546: .B s ! 547: below) ! 548: to specify a portion of a line which is to be replaced. ! 549: If it is desired to use one of ! 550: the regular expression metacharacters as an ordinary ! 551: character, that character may be preceded by ! 552: .BR \e . ! 553: This also applies to the character bounding the regular ! 554: expression ! 555: (often ! 556: .BR / ) ! 557: and to ! 558: .B \e ! 559: itself. ! 560: .PP ! 561: To understand addressing in ! 562: .I \*(ed ! 563: it is necessary to know that at any time there is a ! 564: .IR "current line" . ! 565: Generally speaking, the current line is ! 566: the last line affected by a command; however, ! 567: the exact effect on the current line ! 568: is discussed under the description of the command. ! 569: Addresses are constructed as follows. ! 570: .IP 1. ! 571: The character ! 572: .B . ! 573: addresses the current line. ! 574: .IP 2. ! 575: The character ! 576: .B $ ! 577: addresses the last line of the buffer. ! 578: .IP 3. ! 579: A decimal number ! 580: .I n ! 581: addresses the ! 582: .IR n -th ! 583: line of the buffer. ! 584: .IP 4. ! 585: .BI \(aa x ! 586: addresses the line (or lines) marked with the ! 587: mark name character ! 588: .IR x , ! 589: which must be a lower-case letter. ! 590: An alternative to this syntax is the capital ! 591: letter alone. ! 592: Lines are marked with the ! 593: .B k ! 594: command described below. ! 595: .IP 5. ! 596: .B \(aa\c ! 597: .IB x ^ ! 598: (or ! 599: .IB X ^\c ! 600: ) addresses the first (lower) ! 601: line of the range marked ! 602: with the mark name character ! 603: .IR x . ! 604: (See the ! 605: .I k ! 606: command description.) ! 607: .IP 6. ! 608: .B \(aa\c ! 609: .IB x $ ! 610: (or ! 611: .IB X $\c ! 612: ) addresses the last (upper) ! 613: line of the range marked ! 614: with the mark name character ! 615: .IR x . ! 616: (See the ! 617: .B k ! 618: command description.) ! 619: .IP 7. ! 620: A regular expression enclosed in slashes ! 621: .B / ! 622: addresses ! 623: the first line found by searching toward the end of the ! 624: buffer and stopping at the first line containing a ! 625: string matching the regular expression. ! 626: If necessary the search wraps around to the beginning of the buffer. ! 627: .IP 8. ! 628: A regular expression enclosed in queries ! 629: .B ? ! 630: addresses ! 631: the first line found by searching toward the beginning of ! 632: the buffer and stopping at the first line containing ! 633: a string matching the regular expression. ! 634: If necessary the search wraps around to the end of the buffer. ! 635: .IP 9. ! 636: An address followed by a plus sign ! 637: .B + ! 638: or a minus sign ! 639: .B \(mi ! 640: followed by a decimal number ! 641: specifies that address plus ! 642: (resp. minus) ! 643: the indicated number of lines. ! 644: The plus sign may be omitted. ! 645: .IP 10. ! 646: If an address begins with ! 647: .B + ! 648: or ! 649: .B \(mi ! 650: the addition or subtraction is taken with respect to the current line; ! 651: e\.g\. ! 652: .B \(mi5 ! 653: is understood to mean ! 654: .BR .\(mi5 . ! 655: (If the first address is omitted, but a second ! 656: bound is specified, then the first address will be the current line ! 657: plus one. ! 658: e.g. \*(oq\c ! 659: .B ,+10\c ! 660: \&\*(cq is equivalent to \*(oq\c ! 661: .B .+1,.+10\c ! 662: \&\*(cq.) ! 663: .IP 11. ! 664: If an address ends with ! 665: .B + ! 666: or ! 667: .BR \(mi , ! 668: then 1 is added (resp. subtracted). ! 669: As a consequence of this rule and rule 10, ! 670: the address ! 671: .B \(mi ! 672: refers to the line before the current line. ! 673: Moreover, trailing ! 674: .B + ! 675: and ! 676: .B \(mi ! 677: characters have cumulative effect, so ! 678: .B \(mi\(mi ! 679: refers to the current ! 680: line less 2. ! 681: (There are complications of this rule, ! 682: see the ! 683: .B b ! 684: command below.) ! 685: .IP 12. ! 686: To maintain compatibility with earlier versions of the editor, ! 687: the character ! 688: .B ^ ! 689: in addresses is entirely equivalent to ! 690: .BR \(mi . ! 691: .IP 13. ! 692: The character ! 693: .B = ! 694: specifies that the address bounds of the ! 695: previous command are to be used for the current command. ! 696: .IP 14. ! 697: The character pair ! 698: .B =^ ! 699: addresses the lower bound ! 700: (first address) specified in the previous command. ! 701: .IP 15. ! 702: The character pair ! 703: .B =$ ! 704: addresses the upper bound ! 705: (second address) specified in the previous command. ! 706: .IP 16. ! 707: The character pair ! 708: .B .. ! 709: addresses the ! 710: last value of ! 711: .B . ! 712: different from the current value of ! 713: .BR . \\|. ! 714: .PP ! 715: Commands may require zero, one, or two addresses. ! 716: Commands which require no addresses regard the presence ! 717: of an address as an error. ! 718: Commands which accept one or two addresses ! 719: assume default addresses when insufficient are given. ! 720: If more addresses are given than such a command requires, ! 721: the last one or two (depending on what is accepted) are used. ! 722: .PP ! 723: Addresses are separated from each other typically by a comma ! 724: .BR , \\|. ! 725: They may also be separated by a semicolon ! 726: .BR ; \\|. ! 727: In this case the current line ! 728: .B . ! 729: is set to ! 730: the first address before the next address is interpreted. ! 731: The second address of any two-address sequence ! 732: must correspond to a line following ! 733: the line corresponding to the first address. ! 734: .PP ! 735: In the following list of ! 736: .I \*(ed ! 737: commands, the default addresses are shown in parentheses. ! 738: The parentheses are not part of the address, ! 739: but are used to show that the given addresses are the default. ! 740: .PP ! 741: As mentioned, it is generally illegal for more than one ! 742: command to appear on a line. However, most commands may be suffixed by ! 743: .BR p , ! 744: .BR b , ! 745: .B q ! 746: or ! 747: .BR l , ! 748: in which case the current line is either ! 749: printed (as in the ! 750: .B p ! 751: command), listed with balanced pairs of parentheses, square brackets, ! 752: and brace brackets numbered (\c ! 753: .BR b ), ! 754: quoted (by ! 755: .B ! 756: " ! 757: or ! 758: .BR \(aa ) ! 759: string lengths (\c ! 760: .BR q ), ! 761: or listed as in the ! 762: .B l ! 763: command. ! 764: .de PI ! 765: .br ! 766: .ne 5 ! 767: .IP ! 768: .ti -.5i ! 769: .. ! 770: .PI ! 771: ( ! 772: .B . ! 773: )\c ! 774: .B a ! 775: .ti -.5i ! 776: .I text ! 777: .ti -.5i ! 778: .B . ! 779: .br ! 780: The ! 781: .I append ! 782: command reads the given text ! 783: and appends it after the addressed line. ! 784: .B . ! 785: is left on the last line input, if there ! 786: were any, otherwise at the addressed line. ! 787: Address \*(oq\c ! 788: .B \*0\c ! 789: \&\*(cq is legal for this command; ! 790: text is placed at the beginning of the buffer. ! 791: .PI ! 792: ( ! 793: .B . ! 794: )\c ! 795: .B a ! 796: .I text ! 797: .br ! 798: If a space immediately follows the ! 799: .I append ! 800: command, ! 801: then the ! 802: .I text ! 803: immediately following the space is appended after ! 804: the addressed line. ! 805: .B . ! 806: is left at the newly created line. ! 807: This is essentially a quick method for entering one line. ! 808: .PI ! 809: ( ! 810: .B . ! 811: , ! 812: .B . ! 813: )\c ! 814: .BI a/ text\c ! 815: .B / ! 816: .br ! 817: Append the text after the last character in the addressed lines. ! 818: .PI ! 819: .BI b nn ! 820: .br ! 821: The ! 822: .I browse ! 823: count is set to ! 824: .I nn ! 825: (decimal). ! 826: This count is then used for subsequent ! 827: .I "new-line" ! 828: commands as the number of lines to be printed out. ! 829: If ! 830: .I nn ! 831: is missing, the count is reset to 1. ! 832: .sp 1 ! 833: In constructing addresses as described in rule 11 above, ! 834: the browse count is added to or subtracted from ! 835: the current address, ! 836: instead of a constant of 1 for each ! 837: .B + ! 838: or ! 839: .BR \(mi . ! 840: Normally this has no effect since the default is 1. ! 841: .PI ! 842: ( ! 843: .B . ! 844: , ! 845: .B . ! 846: )\c ! 847: .B c ! 848: .ti -.5i ! 849: .I text ! 850: .ti -.5i ! 851: .B . ! 852: .br ! 853: The ! 854: .I change ! 855: command deletes the addressed lines, then accepts input ! 856: text which replaces these lines. ! 857: .B . ! 858: is left at the last line input; if there were none, ! 859: it is left at the first line not deleted. ! 860: .PI ! 861: ( ! 862: .B . ! 863: , ! 864: .B . ! 865: )\c ! 866: .BI c/ "regular expression\c" ! 867: .BI / replacement\c ! 868: .B / ! 869: .ti -.5i ! 870: ( ! 871: .B . ! 872: , ! 873: .B . ! 874: )\c ! 875: .BI c/ "regular expression\c" ! 876: .BI / replacement\c ! 877: .BI / nn ! 878: .ti -.5i ! 879: ( ! 880: .B . ! 881: , ! 882: .B . ! 883: )\c ! 884: .BI c/ "regular expression\c" ! 885: .BI / replacement\c ! 886: .B /g ! 887: .br ! 888: This form of the change command is identical to the ! 889: .B s ! 890: command below. ! 891: .PI ! 892: ( ! 893: .B . ! 894: , ! 895: .B . ! 896: )\c ! 897: .BI co a ! 898: .br ! 899: The ! 900: .B co ! 901: (copy) command is identical to the ! 902: .B t ! 903: (transfer) ! 904: command below. ! 905: .PI ! 906: ( ! 907: .B . ! 908: , ! 909: .B . ! 910: )\c ! 911: .B d ! 912: .br ! 913: The ! 914: .I delete ! 915: command deletes the addressed lines from the buffer. ! 916: The line originally after the last line ! 917: deleted becomes the current line; ! 918: if the lines deleted were originally at the end, ! 919: the new last line becomes the current line. ! 920: .PI ! 921: .B d ! 922: .I pathname ! 923: .br ! 924: The current directory is set to ! 925: .I pathname ! 926: by a call to ! 927: .IR chdir (2). ! 928: .PI ! 929: .BI d= nn ! 930: .br ! 931: Sets ! 932: .IR \*(ed 's ! 933: idea of what the ! 934: .I depth ! 935: of the screen is, to ! 936: .I nn ! 937: (decimal) ! 938: lines. ! 939: This is used in calculating how many lines will ! 940: fit on the screen with the ! 941: .B : ! 942: command, and may be preset with the ! 943: .B \(mic ! 944: flag ! 945: (see above). ! 946: .PI ! 947: .B e ! 948: .I filename ! 949: .ti -.5i ! 950: .B ei ! 951: .I filename ! 952: .br ! 953: The ! 954: .I edit ! 955: command causes the entire contents of the buffer to be deleted, ! 956: and then the named file to be read in. ! 957: If no ! 958: .I filename ! 959: is given, the ! 960: .I current ! 961: file is used. ! 962: .B . ! 963: is set to the last line of the buffer. ! 964: The number of lines read is printed. ! 965: .I filename ! 966: (if present) is remembered for ! 967: possible use as a default file name in a subsequent ! 968: .BR e , ! 969: .BR r , ! 970: or ! 971: .B w ! 972: command. ! 973: If the ! 974: .B i ! 975: is present, ! 976: .I \*(ed ! 977: will read ! 978: .I filename ! 979: immediately ! 980: (without double-checking first). ! 981: .PI ! 982: .BI e= c ! 983: .br ! 984: The ! 985: .I end-of-line ! 986: character is set to ! 987: .IR c . ! 988: Thereafter, ! 989: any occurrences of ! 990: .I c ! 991: are treated as if they were an actual newline character. ! 992: This facilitates entering several commands on the same ! 993: physical line. ! 994: .BR Caution : ! 995: the ! 996: .I eol ! 997: character is also interpreted in ! 998: .I insert ! 999: mode. ! 1000: .PI ! 1001: .BI e nn ! 1002: .br ! 1003: Displays the ! 1004: .I long ! 1005: error message for error number ! 1006: .IR nn . ! 1007: .PI ! 1008: .B e+ ! 1009: .ti -.5i ! 1010: .B e\(mi ! 1011: .br ! 1012: If a ! 1013: .B \(mi ! 1014: follows, ! 1015: issue error messages in the form ! 1016: .BI ? nn ! 1017: where ! 1018: .I nn ! 1019: is the error number of the error that occurred. ! 1020: This is mostly useful for slow terminals. ! 1021: A ! 1022: .B + ! 1023: returns to long error messages. ! 1024: (See the ! 1025: .B \(mik ! 1026: flag, ! 1027: and the ! 1028: .BI e nn ! 1029: command above.) ! 1030: .PI ! 1031: ( ! 1032: .B . ! 1033: , ! 1034: .B . ! 1035: )\c ! 1036: .B exp ! 1037: .br ! 1038: Providing that a ! 1039: .I "tab character" ! 1040: has been set ! 1041: (see the ! 1042: .BI t= c ! 1043: command and the ! 1044: .B \(mit ! 1045: flag) ! 1046: as well as ! 1047: .I "tab stops" ! 1048: being set ! 1049: (see the ! 1050: .BI t, nn ! 1051: command), ! 1052: any instances of the ! 1053: .I "tab character" ! 1054: within the addressed lines which are to the left ! 1055: of a column which is marked as a ! 1056: .IR "tab stop" , ! 1057: will be expanded with an appropriate ! 1058: number of ! 1059: .IR "fill characters" . ! 1060: (See the ! 1061: .BI f= c ! 1062: command). ! 1063: .PI ! 1064: .B f ! 1065: .I filename ! 1066: .br ! 1067: The ! 1068: .I filename ! 1069: command prints the currently remembered file name. ! 1070: If ! 1071: .I filename ! 1072: is given, ! 1073: the currently remembered file name is changed to ! 1074: .IB filename . ! 1075: .PI ! 1076: .BI f= c ! 1077: .br ! 1078: Set the ! 1079: .I fill ! 1080: character to ! 1081: .IR c . ! 1082: This is the character used to fill out a line where ! 1083: .I tab ! 1084: characters have been expanded. ! 1085: If ! 1086: .I c ! 1087: is missing, ! 1088: the ! 1089: .I fill ! 1090: character is reset to the default, ! 1091: which uses as many tabs as possible, ! 1092: followed by as many blanks as necessary to reach ! 1093: the desired column, resulting in the fewest possible ! 1094: characters to get to the desired position. ! 1095: .PI ! 1096: ( ! 1097: .B 1 ! 1098: , ! 1099: .B $ ! 1100: )\c ! 1101: .BI g/ "regular expression\c" ! 1102: .BI / command-list ! 1103: .ti -.5i ! 1104: ( ! 1105: .B 1 ! 1106: , ! 1107: .B $ ! 1108: )\c ! 1109: .BI g/ "regular expression\c" ! 1110: .BI /v command-list ! 1111: .br ! 1112: In the ! 1113: .I global ! 1114: command, the first step is to mark every line which matches ! 1115: the given ! 1116: .IR "regular expression" . ! 1117: If the optional ! 1118: .B v ! 1119: is present after the regular expression, ! 1120: each line potentially matching the regular expression will ! 1121: be printed, followed by the message \*(oq\c ! 1122: .B "Ok?\\ \c" ! 1123: \&\*(cq. ! 1124: If the response begins with ! 1125: .IR n , ! 1126: the line will not ! 1127: be marked, any other response will cause the line to ! 1128: be marked. ! 1129: Then for every marked line, the ! 1130: given command list is executed with ! 1131: .B . ! 1132: initially set to that line. ! 1133: A single command or the first of multiple commands ! 1134: appears on the same line with the global command. ! 1135: All lines of a multi-line list except the last line ! 1136: must be ended with ! 1137: .B \e\c ! 1138: \&. ! 1139: The ! 1140: .BR a , ! 1141: .BR i , ! 1142: and ! 1143: .B c ! 1144: commands and associated input are permitted; ! 1145: the ! 1146: .B . ! 1147: terminating input mode may be omitted if it would be on the ! 1148: last line of the command list. ! 1149: The (global) commands, ! 1150: .BR g , ! 1151: and ! 1152: .BR v , ! 1153: are not permitted in the command list. ! 1154: If an ! 1155: .I end-of-file ! 1156: (Ctrl-D) ! 1157: is typed in response to the prompt, ! 1158: no further lines will be scanned or marked, ! 1159: and all lines marked so far (if any) will have ! 1160: .I command-list ! 1161: applied to them. ! 1162: .PI ! 1163: .B h ! 1164: .ti -.5i ! 1165: .BI h nn ! 1166: .br ! 1167: Column numbers to column ! 1168: .I nn ! 1169: (default 71) ! 1170: are printed out. ! 1171: Any columns which have ! 1172: .I tab ! 1173: stops set will print out with ! 1174: .B \(mi ! 1175: character in the appropriate position. ! 1176: .PI ! 1177: .BR he [lp] ! 1178: .br ! 1179: List syntax of all ! 1180: .I \*(ed ! 1181: commands available. ! 1182: (Merely displays the contents of the file ! 1183: .B /etc/\*(ed.doc\c ! 1184: \&.) ! 1185: .PI ! 1186: ( ! 1187: .B . ! 1188: )\c ! 1189: .B i ! 1190: .ti -.5i ! 1191: .I text ! 1192: .ti -.5i ! 1193: .B . ! 1194: .br ! 1195: This command inserts the given text before the addressed line. ! 1196: .B . ! 1197: is left at the last line input; ! 1198: if there were none, ! 1199: at the addressed line. ! 1200: This command differs from the ! 1201: .B a ! 1202: command only in the placement of the text. ! 1203: .PI ! 1204: ( ! 1205: .B . ! 1206: )\c ! 1207: .B i ! 1208: .I text ! 1209: .br ! 1210: This form of the ! 1211: .I insert ! 1212: command inserts one line before the addressed line, ! 1213: consisting of the ! 1214: .I text ! 1215: following the space. ! 1216: (See the ! 1217: .B a ! 1218: command.) ! 1219: .PI ! 1220: ( ! 1221: .B . ! 1222: , ! 1223: .B . ! 1224: )\c ! 1225: .BI i/ text\c ! 1226: .B / ! 1227: .br ! 1228: Insert the text before the first character in the addressed lines. ! 1229: .PI ! 1230: ( ! 1231: .B .\(mi1 ! 1232: , ! 1233: .B . ! 1234: )\c ! 1235: .B j ! 1236: .ti -.5i ! 1237: ( ! 1238: .B .\(mi1 ! 1239: , ! 1240: .B . ! 1241: )\c ! 1242: .BI j/ text\c ! 1243: .B / ! 1244: .br ! 1245: Join the addressed lines together to form one resulting line. ! 1246: This effectively removes the new-line from the ! 1247: ends of all but the last line. ! 1248: (Useful for rejoining lines that ! 1249: were split incorrectly by the ! 1250: .I s ! 1251: command.) ! 1252: .sp 1 ! 1253: If a delimiter ! 1254: (and perhaps some ! 1255: .IR text ) ! 1256: is present, ! 1257: then the ! 1258: .I text ! 1259: will be inserted between the text of the joined lines. ! 1260: .PI ! 1261: .B k ! 1262: .ti -.5i ! 1263: ( ! 1264: .B . ! 1265: , ! 1266: .B . ! 1267: )\c ! 1268: .BI k x ! 1269: .br ! 1270: The mark command marks the addressed line(s) with name ! 1271: .IR x , ! 1272: which must be a letter. ! 1273: Either of the address forms ! 1274: .BI \(aa x ! 1275: or ! 1276: .I X ! 1277: (capital letter) ! 1278: then address this/these line(s). ! 1279: If no character is specified after the command, ! 1280: all currently marked lines are listed. ! 1281: .PI ! 1282: ( ! 1283: .B . ! 1284: , ! 1285: .B . ! 1286: )\c ! 1287: .B l ! 1288: .br ! 1289: The ! 1290: .I list ! 1291: command prints the addressed lines in an unambiguous way: ! 1292: non-graphic characters are printed as ! 1293: .IR ^X , ! 1294: and long lines are folded. ! 1295: .I Tab ! 1296: characters show as ! 1297: \o'->' ! 1298: and ! 1299: .I backspace ! 1300: characters are displayed as ! 1301: \o'-<'. ! 1302: An ! 1303: .B l ! 1304: command may follow most others on the same line. ! 1305: .PI ! 1306: ( ! 1307: .B .+1 ! 1308: , ! 1309: .BI .+ nn ! 1310: )\c ! 1311: .B la ! 1312: .br ! 1313: One ! 1314: .I page ! 1315: of text is listed as in the ! 1316: .B l ! 1317: command above. ! 1318: The text is guaranteed not to scroll off the screen. ! 1319: .PI ! 1320: ( ! 1321: .B 1 ! 1322: , ! 1323: .B $ ! 1324: )\c ! 1325: .B ll ! 1326: .br ! 1327: The entire contents of the edit buffer are listed as if \*(oq\c ! 1328: .B 1,$l\c ! 1329: \&\*(cq had been typed. ! 1330: .PI ! 1331: .B m ! 1332: .br ! 1333: The characters ! 1334: .B ^ ! 1335: .B $ ! 1336: .B . ! 1337: .B * ! 1338: .B [ ! 1339: .B & ! 1340: .B \e( ! 1341: .B \e) ! 1342: and ! 1343: .B \e ! 1344: lose or regain their ! 1345: special meaning in patterns as well as in the substitute command. ! 1346: Each invocation of ! 1347: .B m ! 1348: toggles the \*(oq\c ! 1349: .I magic\c ! 1350: \&\*(cq characters on/off. ! 1351: .PI ! 1352: ( ! 1353: .B . ! 1354: , ! 1355: .B . ! 1356: )\c ! 1357: .BI m a ! 1358: .ti -.5i ! 1359: ( ! 1360: .B . ! 1361: , ! 1362: .B . ! 1363: )\c ! 1364: .BI mo a ! 1365: .br ! 1366: The ! 1367: .I move ! 1368: command repositions the addressed ! 1369: lines after the line addressed by ! 1370: .IR a . ! 1371: The last of the moved lines becomes the current line. ! 1372: .PI ! 1373: .B n ! 1374: .br ! 1375: Line numbering is toggled on or off. ! 1376: .PI ! 1377: .B n+ ! 1378: .ti -.5i ! 1379: .B n\(mi ! 1380: .br ! 1381: Line numbering for the ! 1382: .B | ! 1383: (and other variants) ! 1384: command is turned on for a ! 1385: .BR + , ! 1386: off for a ! 1387: .BR \(mi . ! 1388: .PI ! 1389: ( ! 1390: .B . ! 1391: , ! 1392: .B . ! 1393: )\c ! 1394: .B p ! 1395: .br ! 1396: The ! 1397: .I print ! 1398: command prints the addressed lines. ! 1399: .B . ! 1400: is left at the last line printed. ! 1401: The ! 1402: .B p ! 1403: command may be placed on the same line after most commands. ! 1404: .PI ! 1405: ( ! 1406: .B .+1 ! 1407: , ! 1408: .BI .+ nn ! 1409: )\c ! 1410: .B pa ! 1411: .br ! 1412: One ! 1413: .I page ! 1414: of text is printed out. ! 1415: The text is guaranteed not to scroll off the screen. ! 1416: (See the ! 1417: .B : ! 1418: command below.) ! 1419: .PI ! 1420: ( ! 1421: .B 1 ! 1422: , ! 1423: .B $ ! 1424: )\c ! 1425: .B pp ! 1426: .br ! 1427: The entire contents of the edit buffer are listed as if \*(oq\c ! 1428: .B 1,$p\c ! 1429: \&\*(cq had been typed. ! 1430: .PI ! 1431: .B q ! 1432: .ti -.5i ! 1433: .B qi ! 1434: .br ! 1435: The ! 1436: .I quit ! 1437: command causes ! 1438: .I \*(ed ! 1439: to exit. ! 1440: No automatic write of a file is done. ! 1441: If the edit file has been modified and the entire contents ! 1442: of the buffer have not been written to a file, ! 1443: a query will be issued to insure that the user ! 1444: has not forgotten to write his file. ! 1445: If the ! 1446: .B i ! 1447: is present, the editor will quit immediately ! 1448: (without double-checking first). ! 1449: Moreover, ! 1450: if the ! 1451: .B \(mif ! 1452: flag was selected, ! 1453: the file will ! 1454: .I not ! 1455: be (over)written. ! 1456: .PI ! 1457: ( ! 1458: .B $ ! 1459: )\c ! 1460: .B r ! 1461: .I filename ! 1462: .br ! 1463: The ! 1464: .I read ! 1465: command reads in the given file after the addressed line. ! 1466: If no file name is given, ! 1467: the remembered file name, if any, is used (see ! 1468: .I e ! 1469: and ! 1470: .I f ! 1471: commands). ! 1472: The remembered file name is not changed unless ! 1473: .I filename ! 1474: is the very first file name mentioned. ! 1475: Address \*(oq\c ! 1476: .B \*0\c ! 1477: \&\*(cq is legal for ! 1478: .I r ! 1479: and causes the file to be read at the beginning of the buffer. ! 1480: If the read is successful, the number of lines read is typed. ! 1481: .B . ! 1482: is left at the last line read from the file. ! 1483: .PI ! 1484: .B s ! 1485: .br ! 1486: The ! 1487: .I stop ! 1488: command without any parameters performs an automatic write ! 1489: (\c ! 1490: .BR w ) ! 1491: if the file has been modified and then exits the editor. ! 1492: .PI ! 1493: ( ! 1494: .B . ! 1495: , ! 1496: .B . ! 1497: )\c ! 1498: .BI s/ "regular expression\c" ! 1499: .BI / replacement\c ! 1500: .B / ! 1501: .ti -.5i ! 1502: ( ! 1503: .B . ! 1504: , ! 1505: .B . ! 1506: )\c ! 1507: .BI s/ "regular expression\c" ! 1508: .BI / replacement\c ! 1509: .BI / nn ! 1510: .ti -.5i ! 1511: ( ! 1512: .B . ! 1513: , ! 1514: .B . ! 1515: )\c ! 1516: .BI s/ "regular expression\c" ! 1517: .BI / replacement\c ! 1518: .B /g ! 1519: .br ! 1520: The ! 1521: .I substitute ! 1522: command searches each addressed ! 1523: line for an occurrence of the specified regular expression. ! 1524: On each line in which a match is found, ! 1525: one of the folowing actions are taken for each of the three ! 1526: forms of the command: ! 1527: .IP 1. +.5i ! 1528: The first occurrence of the specified expression ! 1529: is replaced by the replacement text. ! 1530: .IP 2. +0i ! 1531: The ! 1532: .IR nn -th ! 1533: (where ! 1534: .I nn ! 1535: is a decimal number) ! 1536: occurrence of the specified expression ! 1537: is replaced by the replacement text. ! 1538: .IP 3. +0i ! 1539: All occurrences of the specified expression ! 1540: are replaced. ! 1541: .in -.5i ! 1542: .sp 1 ! 1543: It is an error for the substitution to fail on all addressed lines. ! 1544: Any character other than ! 1545: .I newline ! 1546: may be used instead of ! 1547: .B / ! 1548: to delimit the regular expression ! 1549: and the replacement. ! 1550: .B . ! 1551: is left at the last line substituted. ! 1552: .sp 1 ! 1553: An ampersand ! 1554: .B & ! 1555: appearing in the replacement ! 1556: is replaced by the string matching the regular expression. ! 1557: As a more general feature, the characters ! 1558: .B \e\c ! 1559: .I n\c ! 1560: , ! 1561: where ! 1562: .I n ! 1563: is a digit, ! 1564: are replaced by the text matched by the ! 1565: .IR n -th ! 1566: regular subexpression enclosed between ! 1567: .B \e( ! 1568: and ! 1569: .B \e)\c ! 1570: \&. ! 1571: When nested, parenthesized subexpressions are present, ! 1572: .I n ! 1573: is determined by counting occurrences of ! 1574: .B \e( ! 1575: starting from the left. ! 1576: .sp 1 ! 1577: Lines may be split by substituting ! 1578: .I newline ! 1579: characters into them. ! 1580: The newline in the ! 1581: .I replacement ! 1582: must be escaped by preceding it with a ! 1583: .B \e\c ! 1584: \&. ! 1585: .TP -.5i ! 1586: .ti -.5i ! 1587: .BI sa nn ! 1588: .br ! 1589: The ! 1590: .I save-count ! 1591: command changes the default ! 1592: (\n(sa) count of text-changing ! 1593: commands which may be executed before ! 1594: an automatic buffer save will be done. ! 1595: (\c ! 1596: .I nn ! 1597: is a decimal number.) ! 1598: The save file name is the current filename with a ! 1599: .BI . \*(ex ! 1600: extension. ! 1601: A count of zero (\*0) will disable the auto-save feature. ! 1602: .PI ! 1603: .B t ! 1604: .br ! 1605: All tab stops currently in effect, as set by the ! 1606: .BI t, nn ! 1607: command, ! 1608: are listed. ! 1609: .PI ! 1610: ( ! 1611: .B . ! 1612: , ! 1613: .B . ! 1614: )\c ! 1615: .BI t a ! 1616: .br ! 1617: A copy of the addressed lines is ! 1618: .I transferred ! 1619: after address ! 1620: .I a ! 1621: (which may be \*0). ! 1622: .B . ! 1623: is left at the last line of the copy. ! 1624: .PI ! 1625: .BI t= c ! 1626: .br ! 1627: Set ! 1628: .I tab ! 1629: character to ! 1630: .IR c . ! 1631: All occurrences of this character entered by the ! 1632: .B a ! 1633: or ! 1634: .B i ! 1635: commands will be expanded to the appropriate number of ! 1636: .I fill ! 1637: characters to get to the next column with a ! 1638: .IR "tab stop" . ! 1639: Any occurrences of the ! 1640: .I tab ! 1641: character after the last tab column will be untouched. ! 1642: .PI ! 1643: .BI t, nn\c ! 1644: .RI , nn\c ! 1645: ,... ! 1646: .br ! 1647: Set ! 1648: .I "tab stops" ! 1649: in specified (decimal) columns. ! 1650: Numbers preceded by a ! 1651: .B \(mi ! 1652: will clear the tab ! 1653: setting at that position. ! 1654: The number zero clears ! 1655: .I all ! 1656: tab settings. ! 1657: .PI ! 1658: .B u ! 1659: .br ! 1660: The ! 1661: .I undo ! 1662: command will restore the last modified line ! 1663: to its original condition. ! 1664: This is different from the ! 1665: .B x ! 1666: (\c ! 1667: .IR undelete ) ! 1668: command, which recovers blocks of ! 1669: .I deleted ! 1670: lines, whereas ! 1671: .B u ! 1672: will restore only ! 1673: .I one ! 1674: line, when modified by a ! 1675: .I substitution ! 1676: or ! 1677: .I tab ! 1678: expansion. ! 1679: .I Undo ! 1680: will ! 1681: .I not ! 1682: recover from a ! 1683: .I join ! 1684: command, nor ! 1685: from any deletion, which is processed by the ! 1686: .I undelete ! 1687: command. ! 1688: .PI ! 1689: ( ! 1690: .B 1 ! 1691: , ! 1692: .B $ ! 1693: )\c ! 1694: .BI v/ "regular expression\c" ! 1695: .BI / command-list ! 1696: .ti -.5i ! 1697: ( ! 1698: .B 1 ! 1699: , ! 1700: .B $ ! 1701: )\c ! 1702: .BI v/ "regular expression\c" ! 1703: .BI /v command-list ! 1704: .br ! 1705: This command is the same as the ! 1706: .I global ! 1707: command except that the command list is executed ! 1708: with ! 1709: .B . ! 1710: initially set to every line ! 1711: .B except ! 1712: those matching the regular expression. ! 1713: .PI ! 1714: ( ! 1715: .B 1 ! 1716: , ! 1717: .B $ ! 1718: )\c ! 1719: .B w ! 1720: .I filename ! 1721: .ti -.5i ! 1722: ( ! 1723: .B 1 ! 1724: , ! 1725: .B $ ! 1726: )\c ! 1727: .BI w> filename ! 1728: .ti -.5i ! 1729: ( ! 1730: .B 1 ! 1731: , ! 1732: .B $ ! 1733: )\c ! 1734: .B wi ! 1735: .I filename ! 1736: .br ! 1737: The ! 1738: .I write ! 1739: command writes the addressed lines onto ! 1740: the given file. ! 1741: If the file does not exist, ! 1742: it is created ! 1743: (see ! 1744: .IR umask (2)). ! 1745: The remembered file name is not changed unless ! 1746: .I filename ! 1747: is the very first file name mentioned. ! 1748: If no file name is given, ! 1749: the remembered file name, if any, is used ! 1750: (see ! 1751: .B e ! 1752: and ! 1753: .B f ! 1754: commands). ! 1755: .B . ! 1756: is unchanged. ! 1757: If the ! 1758: .B > ! 1759: is present, the addressed lines ! 1760: will be appended onto the end of the file. ! 1761: If the ! 1762: .B wi ! 1763: form is used, ! 1764: and the file is write-locked, ! 1765: then ! 1766: .I \*(ed ! 1767: will attempt to over-ride the file permission, if possible. ! 1768: .PI ! 1769: .BI w= nn ! 1770: .br ! 1771: Sets ! 1772: .IR \*(ed 's ! 1773: idea of how wide the screen is to ! 1774: .I nn ! 1775: columns. ! 1776: This is used in calculating how many lines will ! 1777: fit on the screen with a ! 1778: .B : ! 1779: command, and may be preset with the ! 1780: .B \(miw ! 1781: flag ! 1782: (see above). ! 1783: .PI ! 1784: ( ! 1785: .B . ! 1786: )\c ! 1787: .B x ! 1788: .br ! 1789: .I Undelete ! 1790: is used to recover the most recently deleted ! 1791: (or replaced) ! 1792: block of lines. ! 1793: .B . ! 1794: is left at the last recovered line. ! 1795: .IP ! 1796: .nf ! 1797: Example: ! 1798: 25,34d delete the lines ! 1799: * see the damage ! 1800: 24x recovers the lost lines ! 1801: .fi ! 1802: .PI ! 1803: ( ! 1804: .B . ! 1805: )\c ! 1806: .B y+ ! 1807: .ti -.5i ! 1808: .B y ! 1809: .ti -.5i ! 1810: .B y\(mi ! 1811: .br ! 1812: This command changes the processing of an interrupt ! 1813: received from the terminal. ! 1814: If the ! 1815: .B \(mi ! 1816: is present, normal processing takes place. ! 1817: That is, the message ! 1818: \*(oqINTERRUPT!\*(cq ! 1819: will be displayed on the terminal and ! 1820: .I \*(ed ! 1821: will prompt for another command. ! 1822: If the ! 1823: .B + ! 1824: is present, the addressed line is set as ! 1825: the initial address for the ! 1826: .B : ! 1827: command, which will automatically be ! 1828: invoked upon each interrupt. ! 1829: Lastly, if no character follows, ! 1830: then upon each interrupt, one ! 1831: .I page ! 1832: will be displayed from ! 1833: .B . ! 1834: onward, which is useful for paging through ! 1835: sections of text. ! 1836: .PI ! 1837: .B @ ! 1838: .I filename ! 1839: .ti -.5i ! 1840: .B @p ! 1841: .I filename ! 1842: .br ! 1843: .I \*(Ed ! 1844: opens the specified file, ! 1845: and reads command lines from it. ! 1846: The commands are echoed to the terminal ! 1847: (if the ! 1848: .B p ! 1849: is present) ! 1850: as each character is processed. ! 1851: This allows monitoring the command file as ! 1852: it is running, so that erroneous command line(s) ! 1853: will appear before their respective ! 1854: error messages. ! 1855: If no filename is given, ! 1856: the last ! 1857: .IR indirect ed ! 1858: filename, ! 1859: if any, ! 1860: will be used. ! 1861: .PI ! 1862: .BI ! UNIX-command ! 1863: .br ! 1864: The remainder of the line after the ! 1865: .B ! ! 1866: is sent to the ! 1867: .I shell ! 1868: (see ! 1869: .BR SH (1)) ! 1870: to be interpreted as a ! 1871: .I UNIX ! 1872: command. ! 1873: .B . ! 1874: is unchanged. ! 1875: .PI ! 1876: ( ! 1877: .B . ! 1878: )\c ! 1879: .BI | UNIX-command ! 1880: .br ! 1881: The addressed lines are ! 1882: .I piped ! 1883: as the standard input ! 1884: to the command(s) following the ! 1885: .B | ! 1886: symbol. ! 1887: The ! 1888: .I UNIX ! 1889: command is passed to the ! 1890: .I shell ! 1891: (as in ! 1892: .B ! ! 1893: above) ! 1894: to be processed. ! 1895: Line numbers will not precede the lines of text sent to ! 1896: the command(s) unless explicitly enabled via the ! 1897: .B n+ ! 1898: command (see above). ! 1899: .PI ! 1900: .B |+ ! 1901: .ti -.5i ! 1902: .B |\(mi ! 1903: .br ! 1904: Turn on (or off, respectively) strict checking of the exit status of ! 1905: .I UNIX ! 1906: commands executed via the ! 1907: .B |\\|| ! 1908: command. ! 1909: If checking is enabled, no processing will be done on the text ! 1910: returned by a command which has a non-zero exit status ! 1911: (thereby implying an error occurred). ! 1912: This reduces the chance of erroneous command processing ! 1913: causing loss of lines. ! 1914: Lines deleted by the ! 1915: .B |\\|| ! 1916: command may be recovered with ! 1917: .B x ! 1918: (undelete). ! 1919: .PI ! 1920: ( ! 1921: .B . ! 1922: )\c ! 1923: .BI |\\|| UNIX-command ! 1924: .br ! 1925: This variant of the ! 1926: .I pipe ! 1927: command ! 1928: (commonly referred to as the \*(oq\c ! 1929: .I double-pipe\c ! 1930: \&\*(cq command) ! 1931: performs similarly to the ! 1932: .B | ! 1933: command above, but replaces the lines sent to the command(s) ! 1934: with those received from the command(s) on the standard output ! 1935: of the command(s). ! 1936: If the error status from the command(s) is not that of a ! 1937: .IR "normal exit" , ! 1938: no change will be made in the text. ! 1939: Similarly, ! 1940: (by default) ! 1941: if the exit status of the command(s) is non-zero ! 1942: (possibly indicating an error) ! 1943: no changes will be made. ! 1944: This is due to the existence of many older programs which ! 1945: do not terminate with a meaningful exit status. ! 1946: The strict exit status checking may be disabled via the ! 1947: .B |\(mi ! 1948: command below. ! 1949: An optional ! 1950: .I "line number" ! 1951: (\c ! 1952: .B not ! 1953: address) ! 1954: may immediately follow the ! 1955: .B |\\|| ! 1956: which will specify the line after which the returned ! 1957: lines are to be placed. ! 1958: .PI ! 1959: .BI |< UNIX-command ! 1960: .br ! 1961: Lines generated by the ! 1962: .I UNIX ! 1963: command(s) are inserted after ! 1964: .BR . . ! 1965: An optional ! 1966: .I "line number" ! 1967: (\c ! 1968: .B not ! 1969: address) ! 1970: may immediately follow the ! 1971: .B < ! 1972: which will specify the line after which the returned ! 1973: lines are to be placed. ! 1974: .PI ! 1975: ( ! 1976: .B . ! 1977: )\c ! 1978: .BI |> UNIX-command ! 1979: .br ! 1980: The only difference between this command and the ! 1981: .B |\\|| ! 1982: command above is this variant ! 1983: .I inserts ! 1984: the generated text ! 1985: .I after ! 1986: the lines sent, instead of ! 1987: .I replacing ! 1988: the original lines. ! 1989: An optional ! 1990: .I "line number" ! 1991: (\c ! 1992: .B not ! 1993: address) ! 1994: may immediately follow the ! 1995: .B > ! 1996: which will specify the line after which the returned ! 1997: lines are to be placed. ! 1998: .PI ! 1999: ( ! 2000: .B .+1 ! 2001: , ! 2002: .BI .+ nn ! 2003: )\c ! 2004: .B : ! 2005: .ti -.5i ! 2006: ( ! 2007: .BI .- nn ! 2008: , ! 2009: .B . ! 2010: )\c ! 2011: .B :- ! 2012: .ti -.5i ! 2013: ( ! 2014: .BI .- nn ! 2015: , ! 2016: .BI .+ nn ! 2017: )\c ! 2018: .B * ! 2019: .br ! 2020: One ! 2021: .I page ! 2022: of text is printed out. ! 2023: The text is guaranteed not to scroll off the screen. ! 2024: The first form (just the ! 2025: .B : ! 2026: alone) will start at the addressed line, ! 2027: the line following ! 2028: .B . ! 2029: is the default, ! 2030: and print one screenful, or ! 2031: .I page ! 2032: of text. ! 2033: .B . ! 2034: is set to the last line displayed. ! 2035: The second form, ! 2036: .BR :- , ! 2037: displays one screenful, leaving ! 2038: .B . ! 2039: as the last line displayed, and remaining as the current line. ! 2040: The last form, ! 2041: .BR * , ! 2042: displays one screenful, with ! 2043: .B . ! 2044: centered in the ! 2045: .IR page . ! 2046: .PI ! 2047: ( ! 2048: .B .+1 ! 2049: , ! 2050: .BI .+ nn ! 2051: )\c ! 2052: .I (newline) ! 2053: .br ! 2054: An address alone on a line causes the addressed line to be printed. ! 2055: A blank line alone is equivalent to \*(oq\c ! 2056: .BI .+1,.+ nn\c ! 2057: .B p\c ! 2058: \&\*(cq; ! 2059: it is useful for stepping through text. ! 2060: The ! 2061: .I nn ! 2062: is the count specified with the ! 2063: .B b ! 2064: command ! 2065: (default 1). ! 2066: .PP ! 2067: If an interrupt signal (ASCII ! 2068: .BR DEL ) ! 2069: is received, ! 2070: .I \*(ed ! 2071: prints ! 2072: \*(oqINTERRUPT!\*(cq ! 2073: and returns to its command level. ! 2074: (See also the ! 2075: .I y ! 2076: command for alternate interrupt processing.) ! 2077: .SH "Some size limitations" ! 2078: .br ! 2079: 512 characters per line, ! 2080: (see the ! 2081: .B \(miB ! 2082: flag above) ! 2083: .br ! 2084: 256 characters per global command list, ! 2085: .br ! 2086: 64 characters per file name, ! 2087: .br ! 2088: 128K characters in the temporary file ! 2089: (PDP-11 version only) ! 2090: .br ! 2091: (256K characters with ! 2092: .B \(mih ! 2093: flag) ! 2094: .br ! 2095: (No limit on the Vax version) ! 2096: .br ! 2097: The limit on the number of lines depends on the amount of core: ! 2098: .ti +.5i ! 2099: each line takes 1 word. ! 2100: .br ! 2101: (The current absolute maximum on the PDP-11's is 24,062 lines.) ! 2102: .SH FILES ! 2103: .TP ! 2104: /tmp/e????? ! 2105: temporary; ????? is process number (in decimal). ! 2106: .TP ! 2107: /tmp/ep????? ! 2108: temporary for ! 2109: .B |\\|| ! 2110: stuff. ! 2111: .TP ! 2112: *.hup ! 2113: if ! 2114: .I hangup ! 2115: signal is received. ! 2116: .TP ! 2117: *.bak ! 2118: if ! 2119: .B \(mib ! 2120: flag is specified. ! 2121: .TP ! 2122: *.int ! 2123: if ! 2124: .B \(mii ! 2125: flag is specified and an ! 2126: .I interrupt ! 2127: is received. ! 2128: .TP ! 2129: *.\*(ex ! 2130: auto-save (every \n(sa commands). ! 2131: .TP ! 2132: *.trm ! 2133: if ! 2134: .I termination ! 2135: signal is received. ! 2136: .TP ! 2137: /etc/\*(ed.doc ! 2138: for the ! 2139: .BR he lp ! 2140: command. ! 2141: .SH DIAGNOSTICS ! 2142: Each command has self-explanatory ! 2143: error messages. ! 2144: .SH "SEE ALSO" ! 2145: ed(1), edit(1), eed(1), ex(1), umask(2), vi(1) ! 2146: .br ! 2147: A Tutorial Introduction to the ! 2148: .B ED ! 2149: Text Editor \(mi B. W. Kernighan ! 2150: .SH BUGS ! 2151: A ! 2152: .B \e ! 2153: followed by a ! 2154: .IR newline , ! 2155: useful for splitting lines ! 2156: with the substitute command, may not be passed through ! 2157: the global command. ! 2158: ! 2159: If line(s) are deleted which include the endpoints of ! 2160: a range marked with the ! 2161: .B k ! 2162: command, ! 2163: that mark-name character will ! 2164: not work correctly.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.