|
|
1.1 ! root 1: ! 2: ! 3: ed Command ed ! 4: ! 5: ! 6: ! 7: ! 8: Interactive line editor ! 9: ! 10: eedd [-] [+ccmmooppssvv] [_f_i_l_e] ! 11: ! 12: ed is the COHERENT system's interactive line editor. ! 13: ! 14: ed is a line-oriented interactive text editor. With it, you can ! 15: locate and replace text patterns, move or copy blocks of text, ! 16: and print parts of the text. ed can read text from input files ! 17: and can write all or part of the edited text to other files. ! 18: ! 19: ed reads commands from the standard input, usually one command ! 20: per line. Normally, ed does not prompt for commands. If the ! 21: optional file argument is given, ed edits the given file, as if ! 22: the file were read with the e command described below. ! 23: ! 24: ed manipulates a copy of the text in memory rather than with the ! 25: file itself. No changes to a file occur until the user writes ! 26: edited text with the w command. Large files can be divided with ! 27: split or edited with the stream editor sed. ! 28: ! 29: ed remembers some information to simplify its commands. The cur- ! 30: rent line is typically the line most recently edited or printed. ! 31: When ed reads in a file, the last line read becomes the current ! 32: line. The current file name is the last file name specified in ! 33: an e or f command. The current search pattern is the last pat- ! 34: tern specified in a search specification. ! 35: ! 36: ed identifies text lines by integer line numbers, beginning with ! 37: one for the first line. Several special forms identify a line or ! 38: a range of lines, as follows: ! 39: ! 40: _n A decimal number n specifies the nth line of the text. ! 41: ! 42: . A period `.' specifies the current line. ! 43: ! 44: $ A dollar sign `$' specifies the last line of the text. ! 45: ! 46: +,- Simple arithmetic may be performed on line numbers. ! 47: ! 48: /_p_a_t_t_e_r_n/ ! 49: Search forward from the current line for the next occurrence ! 50: of the pattern. If ed finds no occurrence before the end of ! 51: the text, the search wraps to the beginning of the text. ! 52: Patterns, also called regular expressions, are described in ! 53: detail below. ! 54: ! 55: ?_p_a_t_t_e_r_n? ! 56: Search backwards from the current line to the previous oc- ! 57: currence of the pattern. If ed finds no occurrence before ! 58: the beginning of the text, the search wraps to the end of ! 59: the text. ! 60: ! 61: ! 62: ! 63: ! 64: COHERENT Lexicon Page 1 ! 65: ! 66: ! 67: ! 68: ! 69: ed Command ed ! 70: ! 71: ! 72: ! 73: '_x Lines marked with the kx command described below are iden- ! 74: tified by 'x. The x may be any lower-case letter. ! 75: ! 76: _n,_m Line specifiers separated by a comma `,' specify the range ! 77: of lines between the two given lines, inclusive. ! 78: ! 79: _n;_m Line specifiers separated by a semicolon `;' specify the ! 80: range of lines between the two given lines, inclusive. Nor- ! 81: mally, ed updates the current line after it executes each ! 82: command. If a semicolon `;' rather than a comma separates ! 83: two line specifiers, ed updates the current line before ! 84: reading the second. ! 85: ! 86: * An asterisk `*' specifies all lines; it is equivalent to ! 87: 1,$. ! 88: ! 89: ***** Commands ***** ! 90: ! 91: ed commands consist of a single letter, which may be preceded by ! 92: one or two specifiers that give the line or lines to which the ! 93: command is to be applied. The following command summary uses the ! 94: notations [_n] and [_n[,_m]] to refer to an optional line specifier ! 95: and an optional range, respectively. These default to the cur- ! 96: rent line when omitted, except where otherwise noted. A semi- ! 97: colon `;' may be used instead of a comma `,' to separate two line ! 98: specifiers. ! 99: ! 100: . Print the current line. Also, a line containing only a ! 101: period `.' marks the end of appended, changed, or inserted ! 102: text. ! 103: ! 104: [_n] Print given line. If no line number is given (i.e., the ! 105: command line consists only of a newline character), print ! 106: the line that follows the current line. ! 107: ! 108: [_n]= Print the specified line number (default: last line number). ! 109: ! 110: [_n]& Print a screen of 23 lines; equivalent to _n,_n+2222pp. ! 111: ! 112: ! _l_i_n_e ! 113: Pass the given line to the shell sh for execution. ed ! 114: prompts with an exclamation point `!' when execution is com- ! 115: pleted. ! 116: ! 117: ? Print a brief description of the most recent error. ! 118: ! 119: [_n]aa Append new text after line n. Terminate new text with line ! 120: that contains only a period `.'. ! 121: ! 122: [_n[,_m]]cc ! 123: Change specified lines to new text. Terminate new text with ! 124: a line that contains only a period `.'. ! 125: ! 126: [_n[,_m]]dd[pp] ! 127: Delete specified lines. If p follows, print new current ! 128: ! 129: ! 130: COHERENT Lexicon Page 2 ! 131: ! 132: ! 133: ! 134: ! 135: ed Command ed ! 136: ! 137: ! 138: ! 139: line. ! 140: ! 141: ee [_f_i_l_e] ! 142: Edit the specified file (default: current file name). An ! 143: error occurs if there are unsaved changes. Reissuing the ! 144: command after the error message forces ed to edit the file. ! 145: ! 146: EE [_f_i_l_e] ! 147: Edit the specified file (default: current file name). No ! 148: error occurs if there are unsaved changes. ! 149: ! 150: ff [_f_i_l_e] ! 151: Change the current file name to file and print it. If file ! 152: is omitted, print the current file name. ! 153: ! 154: [_n[,_m]]gg/[_p_a_t_t_e_r_n]/_c_o_m_m_a_n_d_s ! 155: Globally execute commands for each line in the specified ! 156: range (default: all lines) that contains the pattern ! 157: (default: current search pattern). The commands may extend ! 158: over several lines, with all but the last terminated by `\'. ! 159: ! 160: [_n]ii Insert text before line n. Terminate new text with a line ! 161: that contains only a period `.'. ! 162: ! 163: [_n[,_m]]jj[pp] ! 164: Join specified lines into one line. If m is not specified, ! 165: use range n, If no range is specified, join the current line ! 166: with the next line. With optional p, print resulting line. ! 167: ! 168: [_n]kk_x ! 169: Mark given line with lower-case letter x. ! 170: ! 171: [_n[,_m]]ll ! 172: List selected lines, interpreting non-graphic characters. ! 173: ! 174: [_n[,_m]]mm[_d] ! 175: Move selected lines to follow line d (default: current ! 176: line). ! 177: ! 178: oo _o_p_t_i_o_n_s ! 179: Change the given options. The options may consist of an ! 180: optional sign `+' or `-', followed by one or more of the ! 181: letters `ccmmooppssvv'. Options are explained below. ! 182: ! 183: [_n[,_m]][pp] ! 184: Print selected lines. The p is optional. ! 185: ! 186: qq Quit editing and exit. An error occurs if there are unsaved ! 187: changes. Reissuing the command after the error message for- ! 188: ces ed to exit. ! 189: ! 190: QQ Quit editing and exit. No error occurs if there are unsaved ! 191: changes. ! 192: ! 193: ! 194: ! 195: ! 196: COHERENT Lexicon Page 3 ! 197: ! 198: ! 199: ! 200: ! 201: ed Command ed ! 202: ! 203: ! 204: ! 205: [_n]rr [_f_i_l_e] ! 206: Read file into current text after given line (default: last ! 207: line). ! 208: ! 209: [_n[,_m]]ss[_k]/[_p_a_t_t_e_r_n_1]/_p_a_t_t_e_r_n_2/[gg][pp] ! 210: Search for pattern1 (default, remembered search pattern) and ! 211: substitute pattern2 for kth occurrence (default, first) on ! 212: each line of the given range. If g follows, substitute ! 213: every occurrence on each line. If p follows, print the ! 214: resulting current line. ! 215: ! 216: [_n[,_m]]tt[_d] ! 217: Transfer (copy) selected lines to follow line d (default, ! 218: current line). ! 219: ! 220: [_n]uu[pp] ! 221: Undo effect of last substitute command. If optional p ! 222: specified, print undone line. The specified line must be ! 223: the last substituted line. ! 224: ! 225: [_n[,_m]]vv/[_p_a_t_t_e_r_n]/_c_o_m_m_a_n_d_s ! 226: Globally execute commands for each line in the specified ! 227: range (default: all lines) not containing the pattern ! 228: (default: current search pattern). The commands may extend ! 229: over several lines, with all but the last terminated by `\'. ! 230: The v command is like the g command, except the sense of the ! 231: search is reversed. ! 232: ! 233: [_n[,_m]]ww [_f_i_l_e] ! 234: Write selected lines (default, all lines) to file (default, ! 235: current file name). The previous contents of file, if any, ! 236: are lost. ! 237: ! 238: [_n[,_m]]WW [_f_i_l_e] ! 239: Write specified lines (default, all lines) to the end of ! 240: file (default, current file name). Like w, but appends to ! 241: file instead of truncating it. ! 242: ! 243: ***** Patterns ***** ! 244: ! 245: Substitution commands and search specifications may include pat- ! 246: terns, also called regular expressions. A non-special character ! 247: in a pattern matches itself. Special characters include the ! 248: following. ! 249: ! 250: ^ Match beginning of line, unless it appears immediately after ! 251: `[' (see below). ! 252: ! 253: $ Match end of line. ! 254: ! 255: * Matches zero or more repetitions of preceding character. ! 256: ! 257: . Matches any character except newline. ! 258: ! 259: ! 260: ! 261: ! 262: COHERENT Lexicon Page 4 ! 263: ! 264: ! 265: ! 266: ! 267: ed Command ed ! 268: ! 269: ! 270: ! 271: [_c_h_a_r_s] ! 272: Matches any one of the enclosed chars. Ranges of letters or ! 273: digits may be indicated using `-'. ! 274: ! 275: [^_c_h_a_r_s] ! 276: Matches any character except one of the enclosed chars. ! 277: Ranges of letters or digits may be indicated using `-'. ! 278: ! 279: \_c Disregard special meaning of character c. ! 280: ! 281: \(_p_a_t_t_e_r_n\) ! 282: Delimit substring pattern for use with \_d, described below. ! 283: ! 284: The replacement part pattern2 of the substitute command may also ! 285: use the following: ! 286: ! 287: & Insert characters matched by pattern1. ! 288: ! 289: \_d Insert substring delimited by dth occurrence of delimiters ! 290: `\(' and `\)', where d is a digit. ! 291: ! 292: ***** Options ***** ! 293: ! 294: The user may specify ed options on the command line, in the en- ! 295: vironment, or with the o command. The available options are as ! 296: follows: ! 297: ! 298: cc Print character counts on e, r, and w commands. ! 299: ! 300: mm Allow multiple commands per line. ! 301: ! 302: oo Print line counts instead of character counts on e, r, and w ! 303: commands. ! 304: ! 305: pp Prompt with an `*' for each command. ! 306: ! 307: ss Match lower-case letters in a pattern to both upper-case and ! 308: lower-case text characters. ! 309: ! 310: vv Print verbose versions of error messages. ! 311: ! 312: The c option is normally set, and all others are normally reset. ! 313: Options may be set on the command line with a leading `+' sign. ! 314: The `-' command line option resets the c option. ! 315: ! 316: Options may be set in the environment with an assignment, such as ! 317: ! 318: ! 319: export ED=+cv ! 320: ! 321: ! 322: Options may be set with the `+' prefix or reset with the `-' ! 323: prefix. ! 324: ! 325: ! 326: ! 327: ! 328: COHERENT Lexicon Page 5 ! 329: ! 330: ! 331: ! 332: ! 333: ed Command ed ! 334: ! 335: ! 336: ! 337: ***** See Also ***** ! 338: ! 339: commands, me, sed ! 340: _I_n_t_r_o_d_u_c_t_i_o_n _t_o _e_d ! 341: ! 342: ***** Diagnostics ***** ! 343: ! 344: ed usually prints only the diagnostic `?' on any error. When the ! 345: verbose option v is specified, the `?' is followed by a brief ! 346: description of the nature of the error. ! 347: ! 348: ! 349: ! 350: ! 351: ! 352: ! 353: ! 354: ! 355: ! 356: ! 357: ! 358: ! 359: ! 360: ! 361: ! 362: ! 363: ! 364: ! 365: ! 366: ! 367: ! 368: ! 369: ! 370: ! 371: ! 372: ! 373: ! 374: ! 375: ! 376: ! 377: ! 378: ! 379: ! 380: ! 381: ! 382: ! 383: ! 384: ! 385: ! 386: ! 387: ! 388: ! 389: ! 390: ! 391: ! 392: ! 393: ! 394: COHERENT Lexicon Page 6 ! 395: ! 396:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.