Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ed — Apollo

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ED COMMANDS

PATTERNS

CE

ED_DM

1.1; ed (edit), revision 1.1, 81/07/01
ED (EDIT) -- Invoke line editor.
usage:  ED [-N] [pathname]


FORMAT

  ED [-N] [pathname]

  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.

  NOTE:  There is a synonymous DM command: ED -- Delete character preceding
                                                 cursor.  Type HELP ED_DM for
                                                 details.

ARGUMENT

  pathname
  (optional)       Specify 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 are limited to 6400 lines.

                   If the 'pathname' argument is omitted, the edit buffer is
                   empty and no file name is remembered for future use.
                   You will have to specify an explicit file name when you
                   exit the editor.


OPTION

  -N               Suppress the printing of line counts by the E (edit),
                   R (read), and W (write) commands.



SUMMARY OF ED COMMANDS

  Commands to ED have a consistent format: zero, one, or two line addresses
  followed by a single character command, with optional parameters following
  the command.  The general format is:

       [line,][line]command parameters

  The [line] specifies a line number or address in the current edit buffer.
  There is usually a useful default for each command (normally the current
  line) so that you don't need to specify an address explicitly.

  Addresses:

     17      a decimal number
     .       the current line
     $       the last line of the file
     /pat/   search forward for line containing pat
     \pat\   search backward for line containing pat
     line+n  n lines forward from line
     line-n  n lines backward from line

  Defaults:

     (.)     use current line
     (.+1)   use the next line
     (.,.)   use 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 last n lines before
                           current line.  If 'B.' is specified, print n
                           lines with current line in center of screen.
   (.,.)   C               Change text (text follows)
   (.,.)   D               Delete text
           E file          Discard current text, enter file, remember file name
           F               Print file name
           F file          Remember file name
   (.)     I               Insert text before line (text follows)
   (.,.)   Kline           Copy text to new line after specified line
   (.,.)   Mline           Move text to line after specified line
   (.,.)   P               Print text (can be appended to other commands)
           Q               Quit
   (.)     R [file]        Read file, appending after current line
   (.,.)   S/pat/new/GP    Substitute new for leftmost pat (G implies all
                           occurrences)
   (1,$)   W [file]        Write file, leave current text unaltered (if
                           no file is specified, write to current filename)
   (.)     =[P]            Print line number, current line
   (.+1)   <CR>            Print next line
   (1,$)   G/pat/command   Execute command on lines containing pat
                           (except A, C, I, Q commands)
   (1,$)   X/pat/command   Execute command on lines not containing pat
                           (except A, C, I, Q commands)
           # ...           Comment
           $n              Read or write temporary buffer, "n".

  The error message "?" is printed whenever a command fails or is not
  understood.

LIMITATIONS

  o  Files being edited can contain up to 6400 lines.

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

  o  Problems sometimes occur when removing or inserting NEWLINE characters
     (via @n), especially in global commands.


RELATED TOPICS

  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 Display Manager command.




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