Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

10.0;ed (edit), revision 1.0, 88/01/21
ed (edit) -- Invoke line editor.
usage:  ed [-n] [pathname]



DESCRIPTION
     ed invokes the line editor.  Input text and editing commands are read
     from standard input.  While you may use ed to create text files
     interactively, it is better suited for use in programs and scripts.  Use
     the EDIT key or the DM command, ce, to create and edit files
     interactively.


ARGUMENTS
     pathname (optional)
                    Specify the file to be edited.  ed reads the file into a
                    buffer for editing and remembers its name for future use.
                    ed operates on the buffer copy;  changes made there have
                    no effect on the original file until you issue a w (write)
                    command from within ed.  Files must be less than 6400
                    lines and less than 256,000 characters.

                    If you omit the pathname argument, the edit buffer is
                    empty and no filename is remembered for future use.  You
                    must specify an explicit filename when you exit the
                    editor.

                    Default if omitted:  see above

OPTIONS
     -n             Suppress the printing of line counts by the e (edit), r
                    (read), and w (write) commands.

SUMMARY OF ED COMMANDS
     Addresses:

     17             A decimal number.

     .              The current line.

     $              The last line of the file.

     /pat/          Search forward for a line containing pat.

     \pat\          Search backward for a line containing pat.

     line+n         n lines forward from line.

     line-n         n lines backward from line.

     Defaults:


     (.)            Use the current line.

     (.+1)          Use the next line.

     (.,.)          Use the current line for both line numbers.

     (1,$)          Use all lines.

     Commands:


     (.)   A        Append text after line (text follows).

     (.,.n Bn       Browse over the next n lines (default n is 22).  If n is
                    negative, print the last n lines before the current line.
                    If B is specified, print n lines with the current line in
                    the center of screen.

     (.,.) C        Change text (text follows).

     (.,.) D        Delete text.

     E file         Discard the current text, enter file, remember filename.

     F              Print filename.

     F file         Remember filename.

     (.)   I        Insert text before the line (text follows).

     (.,.) Kline    Copy text to a new line after the specified line.

     (.,.) Mline    Move text to a line after the specified line.

     (.,.) P        Print text. (You can append this to other commands.)

     Q              Quit.

     (.)   R [file] Read file, appending after the current line.

     (.,.) S/pat/new/GP
                    Substitute new for leftmost pat. (G implies all
                    occurrences.)

     (1,$) W [file] Write the file; leave the current text unaltered. (If you
                    do  not specify a  file, write to current filename.)

     (.)   =[P]     Print the line number and current line.

     (.+1) <CR>          Print the next line.

     (1,$) G/pat/command Execute command on lines containing pat (except A, C,
                         I, and Q commands).

     (1,$) X/pat/command Execute command on lines not containing pat (except
                         A, C, I, and Q commands).

     # ...               Comment.

     $n                  Read or write temporary buffer, n.

     ed prints the error message "?" whenever it does not understand or fails
     to execute a command

NOTE
     There is a homonymous DM command: ed -- delete the character preceding
     the cursor.

LIMITATIONS
     ⊕  Files being edited can contain up to 6400 lines.

     ⊕  When a global search and substitute combination fails, the entire
        global search stops.

     ⊕  Problems sometimes occur when you use @n to remove or insert newline
        characters, especially in global commands.


SEE ALSO
     More information is available.  Type

     help ed commands
                    For detailed information about each ed command

     help patterns  For information about the pattern-matching scheme

     help ce        For information on creating and editing files
                    interactively

     help ed_dm     For information on the synonymous DM command

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026