ed(1)


NAME
     ed - editor

SYNOPSIS
     ed file

OPTIONS

     -    Suppress line/byte count messages (for in scripts)

EXAMPLES

     ed prog.c           # Edit prog.c

     echo '1,$p' | ed - file
                         # Odd way to write 'cat file'

DESCRIPTION

     Ed is functionally equivalent to the standard V7 editor, ed. It  supports
     the following commands:

           (.)  a: append
           (.,.) c: change
           (.,.) d: delete
                e: edit new file"
                f: print name of edited file"
           (1,$) g: global command
           (.)  i: insert
           (.,.+1) j: join lines together
           (.)  k: mark
           (.)  l: print with special characters in octal
           (.,.) m: move
           (.,.) p: print
                q: quit editor"
           (.)  r: read in new file
           (.,.) s: substitute
           (1,$) v: like g, except select lines that do not match
           (1,$) w: write out edited file
     Many of the commands can take one or two addresses, as  indicated  above.
     The  defaults  are  shown  in parentheses.  Thus a appends to the current
     line, and g works on the whole file as default. The  dot  refers  to  the
     current  line.   Below  is  a  sample editing session with comments given
     following the # symbol.

           ed prog.c               # Edit prog.c
           3,20p                   # Print lines 3 through 20
           /whole/                 # Find next occurence of whole
           s/whole/while/          # Replace whole by while
           g/Buf/s//BUF/g          # Replace Buf by BUF everywhere
           w                       # Write the file back
           q                       # Exit the editor
     Ed is provided for its sentimental value.  If you  want  a  line-oriented
     editor, try ex.  If you want a good editor, use elle, elvis, or mined.

SEE ALSO
     elvis(1), elle(9), mined(9).