


      EEEEDDDDIIIITTTT((((1111))))                     ((((bbbbssssdddd 4444....1111))))                     EEEEDDDDIIIITTTT((((1111))))



      NNNNAAAAMMMMEEEE
           edit - text editor (variant of ex for casual users)

      SSSSYYYYNNNNTTTTAAAAXXXX
           eeeeddddiiiitttt [ ----rrrr ] name ...

      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
           _E_d_i_t is a variant of the text editor _e_x recommended for new
           or casual users who wish to use a command oriented editor.
           The following brief introduction should help you get started
           with _e_d_i_t. See _e_x(1) for other useful documents; in
           particular, if you are using a CRT terminal you will want to
           learn about the display editor _v_i.

      BBBBRRRRIIIIEEEEFFFF IIIINNNNTTTTRRRROOOODDDDUUUUCCCCTTTTIIIIOOOONNNN
           To edit the contents of an existing file you begin with the
           command ``edit name'' to the shell.  _E_d_i_t makes a copy of
           the file which you can then edit, and tells you how many
           lines and characters are in the file.  To create a new file,
           just make up a name for the file and try to run _e_d_i_t on it;
           you will cause an error diagnostic, but don't worry.

           _E_d_i_t prompts for commands with the character `:', which you
           should see after starting the editor.  If you are editing an
           existing file, then you will have some lines in _e_d_i_t'_s
           buffer (its name for the copy of the file you are editing).
           Most _e_d_i_t commands perform their actions on the ``current
           line'' unless otherwise specified.  So, if you enter pppprrrriiiinnnntttt
           (or abbreviated pppp) and press RETURN, this current line will
           be printed.  If you ddddeeeelllleeeetttteeee (dddd) the current line, _e_d_i_t will
           print the new current line.  When you start editing, _e_d_i_t
           makes the last line of the file the current line.  If you
           ddddeeeelllleeeetttteeee this last line, then the new last line becomes the
           current one.  In general, after a ddddeeeelllleeeetttteeee,,,, the next line in
           the file becomes the current line.  (Deleting the last line
           is a special case.)

           If you start with an empty file, or wish to add some new
           lines, then the aaaappppppppeeeennnndddd (aaaa) command can be used.  After you
           enter this command (and press RETURN after the word aaaappppppppeeeennnndddd)
           _e_d_i_t reads lines from the terminal until you give a line
           consisting of just a ``....'', placing these lines after the
           current line.  The last line you type then becomes the
           current line.  The command iiiinnnnsssseeeerrrrtttt (iiii) is like aaaappppppppeeeennnndddd but
           places the lines you give before, rather than after, the
           current line.

           _E_d_i_t numbers the lines in the buffer, with the first line
           having number 1.  If you give the command ``1'' then _e_d_i_t
           will type this first line.  If you then give the command
           ddddeeeelllleeeetttteeee _e_d_i_t will delete the first line, and line 2 will
           become line 1, and _e_d_i_t will print the current line (the new



      Page 1                                                   (9010-E)






      EEEEDDDDIIIITTTT((((1111))))                     ((((bbbbssssdddd 4444....1111))))                     EEEEDDDDIIIITTTT((((1111))))



           line 1) so you can see where you are.  In general, the
           current line will always be the last line affected by a
           command.

           You can make a change to some text within the current line
           by using the ssssuuuubbbbssssttttiiiittttuuuutttteeee (ssss) command.  You say ``s/_o_l_d/_n_e_w/''
           where _o_l_d is replaced by the old characters you want to get
           rid of and _n_e_w is the new characters you want to replace it
           with.

           The command ffffiiiilllleeee (ffff) will tell you how many lines there are
           in the buffer you are editing and will say ``[Modified]'' if
           you have changed it.  After modifying a file you can put the
           buffer text back to replace the file by giving a wwwwrrrriiiitttteeee (wwww)
           command.  You can then leave the editor by issuing a qqqquuuuiiiitttt
           (qqqq) command.  If you run _e_d_i_t on a file, but don't change
           it, it is not necessary (but does no harm) to wwwwrrrriiiitttteeee the file
           back.  If you try to qqqquuuuiiiitttt from _e_d_i_t after modifying the
           buffer without writing it out, you will be warned that there
           has been ``No wwwwrrrriiiitttteeee since last change'' and _e_d_i_t will await
           another command.  If you wish not to wwwwrrrriiiitttteeee the buffer out
           then you can issue another qqqquuuuiiiitttt command.  The buffer is then
           irretrievably discarded, and you return to the shell.

           By using the ddddeeeelllleeeetttteeee and aaaappppppppeeeennnndddd commands, and giving line
           numbers to see lines in the file you can make any changes
           you desire.  You should learn at least a few more things,
           however, if you are to use _e_d_i_t more than a few times.

           The cccchhhhaaaannnnggggeeee (cccc) command will change the current line to a
           sequence of lines you supply (as in aaaappppppppeeeennnndddd you give lines up
           to a line consisting of only a ``.'').  You can tell cccchhhhaaaannnnggggeeee
           to change more than one line by giving the line numbers of
           the lines you want to change, i.e. ``3,5change''.  You can
           print lines this way too.  Thus ``1,23p'' prints the first
           23 lines of the file.

           The uuuunnnnddddoooo (uuuu) command will reverse the effect of the last
           command you gave which changed the buffer.  Thus if give a
           ssssuuuubbbbssssttttiiiittttuuuutttteeee command which doesn't do what you want, you can
           say uuuunnnnddddoooo and the old contents of the line will be restored.
           You can also uuuunnnnddddoooo an uuuunnnnddddoooo command so that you can continue
           to change your mind.  _E_d_i_t will give you a warning message
           when commands you do affect more than one line of the
           buffer.  If the amount of change seems unreasonable, you
           should consider doing an _u_n_d_o and looking to see what
           happened.  If you decide that the change is ok, then you can
           _u_n_d_o again to get it back.  Note that commands such as _w_r_i_t_e
           and _q_u_i_t cannot be undone.

           To look at the next line in the buffer, just press RETURN.
           To look at a number of lines, press ^D (control key and DDDD)



      Page 2                                                   (9010-E)






      EEEEDDDDIIIITTTT((((1111))))                     ((((bbbbssssdddd 4444....1111))))                     EEEEDDDDIIIITTTT((((1111))))



           rather than RETIRN.  This will show you a half screen of
           lines on a CRT or 12 lines on a hardcopy terminal.  You can
           look at the text around where you are by giving the command
           ``z.''.  The current line will then be the last line
           printed; you can get back to the line where you were before
           the ``z.'' command by saying ``''''.  The zzzz command can also
           be given other following characters ``z-'' prints a screen
           of text (or 24 lines) ending where you are; ``z+'' prints
           the next screenful.  If you want less than a screenful of
           lines do, e.g., ``z.12'' to get 12 lines total.  This method
           of giving counts works in general; thus you can delete 5
           lines starting with the current line with the command
           ``delete 5''.

           To find things in the file you can use line numbers if you
           happen to know them; since the line numbers change when you
           insert and delete lines this is somewhat unreliable.  You
           can search backwards and forwards in the file for strings by
           giving commands of the form ////tttteeeexxxxtttt//// to search forward for
           _t_e_x_t or ????tttteeeexxxxtttt????  to search backward for _t_e_x_t. If a search
           reaches the end of the file without finding the text it
           wraps, end around, and continues to search back to the line
           where you are.  A useful feature here is a search of the
           form ////^^^^tttteeeexxxxtttt//// which searches for _t_e_x_t at the beginning of a
           line.  Similarly ////tttteeeexxxxtttt$$$$//// searches for _t_e_x_t at the end of a
           line.  You can leave off the trailing / or ? in these
           commands.

           The current line has a symbolic name ``....''; this is most
           useful in a range of lines as in ``.,$print'' which prints
           the rest of the lines in the file.  To get to the last line
           in the file you can refer to it by its symbolic name ``$''.
           Thus the command ``$ delete'' or ``$d'' deletes the last
           line in the file, no matter which line was the current line
           before.  Arithmetic with line references is also possible.
           Thus the line ``$-5'' is the fifth before the last, and
           ``.+20'' is 20 lines after the present.

           You can find out which line you are at by doing ``.=''.
           This is useful if you wish to move or copy a section of text
           within a file or between files.  Find out the first and last
           line numbers you wish to copy or move (say 10 to 20).  For a
           move you can then say ``10,20delete a'' which deletes these
           lines from the file and places them in a buffer named _a.
           _E_d_i_t has 26 such buffers named _a through _z. You can later
           get these lines back by doing ``put a'' to put the contents
           of buffer _a after the current line.  If you want to move or
           copy these lines between files you can give an eeeeddddiiiitttt (eeee)
           command after copying the lines, following it with the name
           of the other file you wish to edit, i.e. ``edit chapter2''.
           By changing _d_e_l_e_t_e to _y_a_n_k above you can get a pattern for
           copying lines.  If the text you wish to move or copy is all



      Page 3                                                   (9010-E)






      EEEEDDDDIIIITTTT((((1111))))                     ((((bbbbssssdddd 4444....1111))))                     EEEEDDDDIIIITTTT((((1111))))



           within one file then you can just say ``10,20move $'' for
           example.  It is not necessary to use named buffers in this
           case (but you can if you wish).

      SSSSEEEEEEEE AAAALLLLSSSSOOOO
           ex(1), vi(1),

      BBBBUUUUGGGGSSSS
           See ex(1).














































      Page 4                                                   (9010-E)



