\chapter{Basics of TECO}
\label{Basics of TECO}

\section{Using TECO}
\label{Using TECO}

     TECO may be called from command level by typing  the  appropriate
     command, followed by a carriage return:
        
\bigskip

\begin{tabular}{ll}
           For RT--11, OS/8,    			& {\tt R TECO} \\
	TOPS--10, and TOPS--20    &                              \\

           For RSTS/E       &                      {\tt RUN TECO\$:TECO} --or-- \\
                            &                      {\tt EDIT/TECO} \\

           For RSX--11       &                      {\tt RUN \$TEC} \\

           For VAX/VMS      &                      {\tt RUN SYS\$SYSTEM:TECO} \\
\end{tabular}

\bigskip

     TECO will respond by printing an asterisk at the left  margin  to
     indicate  that  it  is  ready  to  accept user commands.  At this
     point, you may type one or more commands.

\bigskip

     A TECO command 
\index{TECO command} 
     consists of one or two characters  which  cause  a
     specific  operation  to  be performed.  Some TECO commands may be
     preceded or followed  by  arguments.   Arguments  may  be  either
     numeric  or  textual.   A numeric argument 
\index{numeric argument} 
	is simply an integer
     value which can be used to indicate, for example, the  number  of
     times  a command should be executed.  A text argument 
\index{text argument} 
	is a string
     of ASCII characters which might be, for example, words of text or
     a file specification.

\bigskip

     If a command requires a numeric argument,  the  numeric  argument
     always  precedes  the  command.   If  a  command  requires a text
     argument, the text argument always  follows  the  command.   Each
     text  argument  is  terminated  by a special character (usually a
     {\tt <DELIM>}  character,  which  TECO  hears  as  an  ESCape   --   
	see
     Introduction).   This  indicates  to TECO that the next character
     typed will be the first character of a new command.

\bigskip

     TECO accumulates commands as they are typed in a command  string,
     and  executes  commands  upon  receipt of two consecutive 
	{\tt <DELIM>}
     characters.  
	{\tt <DELIM>} may be any character  you  select  (if  your
     TECO   and   operating   system  support  user-selectable  ESCape
     surrogates -- see sections on {\tt ET} and {\tt EE} flags).  When you 
     type the character you have designated as 
	{\tt <DELIM>}, TECO receives an ESCape
     character, and an \escape (accent grave) is echoed.  
	(If  you  are  not
     using  an  ESCape surrogate -- that is, you are actually pressing
     an \fbox{Escape} key -- a dollar  sign  is  echoed.)  The  accent  grave
     character is used in examples throughout this manual to represent
     typed 
	{\tt <DELIM>}s.  Note that the carriage return character  has  no
     special  significance  to  TECO;   only the 
	{\tt <DELIM><DELIM>} forces
     execution of the command string.

\bigskip

     TECO executes command strings from left to right until either all
     commands have been executed or a command error is recognized.  It
     then prints an asterisk to signal that additional commands may be
     entered. 

\bigskip

     If TECO encounters an  erroneous  command,  it  prints  an  error
     message and ignores the erroneous command as well as all commands
     which follow it.  All error messages are of the form:

\bigskip

     {\tt ?XXX   Message}

\bigskip

     where {\tt XXX} is an error code and the message is  a  description  of
     the error.  Some error messages mention the specific character or
     string of characters in error.  In  these  error  messages,  TECO
     represents the non-printing special characters as follows:

\bigskip

\begin{tabular}{|l|l|} \hline
\centering

          Character      & Form Displayed \\ \hline

          \fbox {TAB}    &      {\tt <TAB>} \\
          \fbox {LF}     &      {\tt <LF>} \\
          \fbox {VT}     &      {\tt <VT>} \\
          \fbox {FF}     &      {\tt <FF>} \\
          \fbox {CR}     &      {\tt <CR>} \\
          \fbox {ESCAPE} &      {\tt <ESC>} \\
          \fbox {CTRL/x} &      {\tt <}\caret{\tt x} \\  \hline
\end{tabular}

\bigskip

     Every error message is  followed  by  an  asterisk  at  the  left
     margin,  indicating  that  TECO  is  ready  to  accept additional
     commands.  If you type a single question mark character  after  a
     TECO-generated  error  message,  TECO  will  print  the erroneous
     command string up to and including the character which caused the
     error  message.   This  helps  you to find errors in long command
     strings and to  determine  how  much  of  a  command  string  was
     executed before the error was encountered.

\bigskip

     You can correct typing errors by hitting the  \fbox {DELETE}  key,  
     which
     may  be  labeled \fbox {DEL} or \fbox {RUBOUT} on your keyboard.  
Each depression
     of the                       
	\fbox{DELETE} key deletes one character and  echoes  it  on  your
     terminal,  beginning  with  the  last  character  typed.  If your
     terminal is a CRT, TECO will actually erase the deleted character
     from  the  screen.   You can delete an entire command string this
     way, if necessary.  To delete an entire line of  commands,  enter
     the  character  {\tt <CTRL/U>},  typed  by holding down the 
     \fbox {CONTROL} key while depressing the \fbox {U} key.

\bigskip
                                                     
     When you are done editing, use the 
	{\tt EX} command to  exit  TECO,  as
     described below in section \ref{Closing Files}

\section{Data Structure Fundamentals}
\label{Data Structure Fundamentals}

     TECO considers any string of ASCII codes to  be  text.   Text  is
     broken  down  into  units  of  characters,  lines,  and pages.  A
     character is one ASCII code.  A line of text is a string of ASCII
     codes  including one line terminator (usually a line feed) as the
     last character on the line.  A page of text is a string of  ASCII
     codes  including one form feed character as the last character on
     the page.

\bigskip

     TECO maintains a text buffer in which text is stored.  The buffer
     usually  contains one page of text, but the terminating form feed
     character never appears in the buffer.   TECO  also  maintains  a
     text buffer pointer.  The pointer is a movable position indicator
     which is never located directly on a  character,  but  is  always
     between characters:  between two characters in the buffer, before
     the first character in the buffer, or after the last character in
     the buffer.

\bigskip

     Line feed and form feed characters are inserted automatically  by
     TECO.   A  line  feed is automatically appended to every carriage
     return typed to TECO and a form feed is appended to the  contents
     of  the  buffer by certain output commands.  Additional line feed
     and form feed characters may be entered into the buffer as  text.
     If  a  form  feed  character  is entered into the buffer, it will
     cause a page break upon output;  text  following  the  form  feed
     will begin a new page.
          
\bigskip

     Finally, TECO maintains an input file and an output file, both of
     which  are  selected  by  the  user  through  file  specification
     commands.  The input file may be on any device  from  which  text
     may  be  accepted.  The output file may be on any device on which
     edited text may be written.

\bigskip

     TECO functions as a ``pipeline'' editor.  Text  is  read  from  the
     input  file  into the text buffer, and is written from the buffer
     onto the output file.   In  the  VAX/VMS  implementation,  it  is
     possible  to  ``back up'' as well as page forward in the file being
     edited.  In other implementations, once text has been written  to
     the  output file, it cannot be accessed again without closing the
     output file and reopening it as an input file.

\section{File Selection Commands}
\label{File Selection Commands}

     Input and output files may be specified to TECO in several  ways.
     The   following  sections  present  first  a  simple  method  for
     specifying files,  and  then  more  sophisticated  commands  that
     permit flexible file selection.

\bigskip

\centerline{NOTE}
\smallskip

\begin {minipage}[t]{4.5in}

         All of the following file selection  commands  are  shown
         with  a  general  argument  of  {\tt filespec}.   The  actual
         contents of this filespec argument are  operating  system
         dependent.  See the operating characteristics appendices.
         Examples include a mixture of  file  specifications  from
         various operating systems.
                    
\end{minipage}

\subsection{Simplified File Selection}
\label{Simplified File Selection}

     For most simple  applications,  you  can  use  special  operating
     system  commands to specify the name of the file you wish to edit
     at the same time that you start up TECO.

\bigskip

     To create a new file:

\centerline {\tt MAKE filespec}

\bigskip

     This command starts up TECO and creates the  specified  file  for
     output.


\bigskip
             
     To edit an existing file:

\centerline {\tt TECO filespec}

\bigskip

     This command starts up TECO and  opens  the  specified  file  for
     editing  while  preserving  the original file (as a backup file).
     It also automatically brings the first page of the file into  the
     text  buffer.   These functions simulate the 
	{\tt EB} command described
     in Chapter \ref{Command Descriptions}.


\bigskip

     If any of the  above  commands  do  not  seem  to  work  on  your
     operating   system,   consult   the   appropriate   appendix  for
     information  about  how  to  install  TECO  and  its   associated
     operating system commands.

\subsection{Input File Specification}
\label{Input File Specification}

     TECO will  accept  input  text  from  any  input  device  in  the
     operating  system.  The input device may be specified by the text
     string supplied in the 
	{\tt ER}  command  (and  which,  like  any  text
     argument,  is terminated by a \fbox {DELIM} character).  The {\tt ER} 
	command
     causes TECO to open the specified file or print an error  message
     if  the  file  is  not  found.   This  command does not cause any
     portion of the file to be read into  the  text  buffer,  however.
     The following examples illustrate use of the {\tt ER} command.

\begin{list}{}{}

	\item [{\tt ERfilespec}\escape ]
\index{[ER]\tt ER}

         	General  form  of  the   {\tt ER} command   where
               {\tt filespec}  is  the  designation of the input
                file.  The command is terminated by a {\tt <DELIM>}
                character.

	\item [{\tt ERPR:\escape}]

		Prepare to read an input file from the  paper
                         tape reader.

	\item [{\tt ERPROG.MAC\escape}]
		Prepare to read input file {\tt PROG.MAC} from  the
                system's default device.

	\item [{\tt ERDX1:PROG.FOR\escape}]

		Prepare to  read  input  file  {\tt PROG.FOR}  from
                         {\tt DX1:}.
\end{list}                   

     TECO will only keep one  input  and  one  output  file  open  and
     selected  at  a  time.   The current input file may be changed by
     simply using the {\tt ER} command to specify a new file.


\bigskip

     It is not always necessary to specify an input file.  If you want
     to  create  a  file  without  using any previously edited text as
     input, you  may  type  commands  to  insert  the  necessary  text
     directly  into  the text buffer from the keyboard and, at the end
     of each page, write the contents of the  buffer  onto  an  output
     file.   Since  all  input is supplied from the keyboard, no input
     file is necessary.

\subsection{Output File Specification}
\label{Output File Specification}

     TECO will write  output  text  onto  any  output  device  in  the
     operating  system.   The output file may be specified by means of
     the text string supplied in an {\tt EW}  command.  If the output  device
     is  a file-structured device (for example, a disk), the file name
     and any extension must be supplied.  If a file name is  specified
     but  no  device  is  explicitly  specified,  the system's default
     device is assumed.  The following examples illustrate use of  the
     {\tt EW}  command.

\begin{list}{}{}

	\item [{\tt EWfilespec\escape}]
\index{[EW] \tt EW}

		General  form  of  the   {\tt EW}    command   where
		{\tt filespec}  is  the designation of the output
	          file.  The command is terminated by a 
			{\tt <DELIM>}
	                  character.

	\item [{\tt EWSYS:TEXT.LST\escape}]

		Prepare to  write  output  file  {\tt TEXT.LST}  on
	          {\tt SYS:}.

	\item [{\tt EWPROG\escape}]
             Prepare to write  output  file  {\tt PROG}  on  the
		system's default device.

	\item [{\tt ERDX1:INPUT.MAC}\escape{\tt EWOUTPUT.MAC}\escape\escape]
		Open an input file {\tt INPUT.MAC} to be  found  on
	        {\tt DX1:}    and   open   an   output  file  named
		{\tt OUTPUT.MAC}.  The double  {\tt <DELIM>}  (echoed  as
		\escape)  terminates the command string and causes
		the string to be  executed.   Note  that  the
		{\tt <DELIM>}  which  terminates the {\tt EW}  command may
		be one of the two {\tt <DELIM>}s  which  terminates
		the command string.

\end{list}

     You do not need to specify an output file if  you  only  want  to
     examine  an  input  file,  without  making  permanent  changes or
     corrections.  In this case, the contents of the input file may be
     read  into  the  text  buffer  page  by  page and examined at the
     terminal.  Since all output is printed on the user  terminal,  no
     output file is needed.

\subsection{Closing Files}
\label{Closing Files}

     When you are finished editing a file, use the {\tt EX} command to close
     out  the  file  and  exit from TECO.  The current contents of the
     text buffer and any portion of the input file that has  not  been
     read yet are copied to the output file before TECO exits.  The {\tt EX}
     command takes no arguments.


\begin{list}{}{\labelsep 20pt}

	\item [{\tt EX}]

\index{[EX] \tt EX}

                  Write the text buffer to the  current  output
                         file, move the remainder of the current input
                         file to the current output  file,  close  the
                         output  file,  then  return  to the operating
                         system.

	\item [{\tt ERFILE.MAC}\escape{\tt EWCOPY.MAC}\escape{\tt EX}\escape\escape]
		Open an  input  file  {\tt FILE.MAC}  and  open  an
	          output file named {\tt COPY.MAC}, then copy all the
                         text in the input file to  the  output  file,
                         close the output file, and exit from TECO.

\end{list}
 
\section{Input and Output Commands}
\label{Input and Output Commands}

     The following commands permit pages of text to be read  into  the
     TECO  text  buffer  from an input file or written from the buffer
     onto an output file.  Once a page of text has been  written  onto
     the  output  file,  it  cannot  be  recalled into the text buffer
     unless the output file is closed and reopened as an input file.


\begin{list}{}{}{\labelsep 20pt}

	\item [{\tt Y}]       

\index{[Y] \tt Y}

		Clear the text buffer, then read the  next  page  of  the
             input  file  into the buffer.  Since the {\tt Y} command causes
             the contents of the text buffer to be  lost,  it  is  not
             permitted  if an output file is open and there is text in
             the buffer.

	\item [{\tt P}]       

\index{[P] \tt P}

		Write the contents of the text buffer onto the next  page
             of  the  output  file, then clear the buffer and read the
             next page of the input file into the buffer.

	\item [{\tt nP}]      
		Execute the {\tt P} command {\tt n} times.  If {\tt n} is not specified,  a
             value of 1 is assumed.

\end{list}

     After each {\tt Y}, {\tt P}, or {\tt nP} command, TECO positions the pointer before
     the first character in the buffer.

\section{Pointer Positioning Commands}
\label{Pointer Positioning Commands}

     The buffer pointer provides the means of specifying the  location
     within  a  block  of  text  at  which  insertions,  deletions  or
     corrections are to be made.  The following  commands  permit  the
     buffer pointer to be moved to a position between any two adjacent
     characters in the buffer.


\begin{list}{}{\labelsep 20pt}

	\item [{\tt J}]       

\index{[J] \tt J}

		Move the pointer to the beginning of the buffer.
	\item [{\tt L}]       
\index{[L] \tt L}

		Move the pointer forward to a position between  the  next
             line feed and the first character of the next line.  That
             is, advance the pointer to  the  beginning  of  the  next
             line.

	\item [{\tt nL}]      
		Execute the {\tt L} command  {\tt n}  times,  where  {\tt n}  is  a  signed
             integer.   A positive value of {\tt n} moves the pointer to the
             beginning of the nth line following the  current  pointer
             position.   A negative value moves the pointer backward n
             lines and positions it at the beginnning of the nth  line
             preceding  the  current  position.   If  {\tt n}  is  zero, the
             pointer is moved to the beginning of the line on which it
             is currently positioned.

	\item [{\tt C}]       

\index{[C] \tt C}

		Advance the pointer forward across one character.

	\item [{\tt nC}]      
		Execute the {\tt C} command  {\tt n}  times,  where  {\tt n}  is  a  signed
             integer.  A positive value of {\tt n} moves the pointer forward
             across {\tt n} characters.  A negative value  of  {\tt n}  moves  the
             pointer  backward across {\tt n} characters.  If {\tt n} is zero, the
             pointer position is not changed.  Remember that there are
             two characters, {\tt <CR>} and {\tt <LF>}, at the end of each line in
             the buffer.

\end{list}

     These commands may be used to move the buffer pointer across  any
     number of lines or characters in either direction;  however, they
     will not move the pointer across a page boundary.  If a {\tt C} command
     attempts to move the pointer backward beyond the beginning of the
     buffer or forward past the end of the buffer, an error message is
     printed and the command is ignored.

\bigskip

     If an {\tt L} command attempts to exceed the page  boundaries  in  this
     manner,  the  pointer  is  positioned at the boundary which would
     have been exceeded.  Thus, in a page of 2000 lines,  the  command
     {\tt -4000L} would position the pointer before the first character in
     the buffer.  The command {\tt 4000L} would position the pointer after
     the last character in the buffer.  No error message is printed in
     either case.

\section{Type Out Commands}
\label{Type Out Commands}

     The following commands permit sections of the text in the  buffer
     to  be  printed  out  on  your  terminal  for examination.  These
     commands do not move the buffer pointer.


\begin{list}{}{\labelsep 20pt}

	\item [{\tt T}]       

\index{[T] \tt T}

		Type the contents of the text  buffer  from  the  current
             position  of  the  pointer through and including the next
             line feed character.

	\item [{\tt nT}]      
		Type {\tt n} lines, where {\tt n} is a signed  integer.   A  positive
             value of {\tt n} causes the {\tt n} lines following the pointer to be
             typed.   A  negative  value  of  {\tt n}  causes  the  {\tt n}  lines
             preceding  the  pointer  to  be typed.  If {\tt n} is zero, the
             contents of the buffer from the beginning of the line  on
             which  the pointer is located up to the pointer is typed.
             This is useful for verifying the location of  the  buffer
             pointer.

	\item [{\tt HT}]      
		Type the entire contents of the text buffer.

	\item [{\tt V}]       

\index{[V] \tt V}

		Type the current line.  Equivalent to the sequence {\tt 0TT}.

\end{list}


\subsection{Immediate Inspection Commands}
\label{Immediate Inspection Commands}

     In addition, there are available as a  convenience  abbreviations
     of two frequently used type out commands.  Each one consists of a
     single character, and must be  the  very  first  character  typed
     after TECO prints its prompting asterisk.  Each of these commands
     takes effect immediately;  there is no  need  to  follow  any  of
     these  commands by any {\tt <DELIM>} character.  For this reason, these
     commands are known as {\em immediate} commands  (see  
     Chapter~\ref{Command String Editing} for
     more information on immediate commands).

\index{[LF] \tt <LF>}

\index{[DELIM] \tt <DELIM>}

\index{[BS] \tt <BS>}

\begin{list}{}{\labelsep 20pt}

	\item [{\tt <LF>}]    
		Immediately execute  an  {\tt LT}  command.   This  command  is
             issued by typing the \fbox{LF} (line feed) key as the first 
		keystroke
             after TECO's prompt.  It causes TECO to move the  pointer
             ahead  one  line  and  then  type  out  the new line.  On
             terminals without a \fbox{LF} key,  typing  {\tt <CTRL/J>}  has
             the same effect.  (See also the next command.)

	\item [{\tt <DELIM>}] 
		Immediately execute an {\tt LT} command.  (Action identical  to
             that  of  the  command  above.) This command is available
             when an ESCape surrogate is active, and  causes  TECO  to
             move the pointer ahead one line and then type out the new
             line when a {\tt <DELIM>} is the first thing typed after TECO's
             prompting asterisk.
             {\em [RSTS/E only]}

	\item [{\tt <BS>}]    
		Immediately execute  a  {\tt -LT}  command.   This  command  is
             issued by typing the \fbox{Backspace} key as the first keystroke
             after TECO's prompt.  It causes TECO to move the  pointer
             back  one  line and then type the line just moved over on
             the terminal.  On  terminals  without  a  \fbox{Backspace}  key,
             typing {\tt <CTRL/H>} has the same effect.
\end{list}

\bigskip

     These commands are useful for ``walking through'' a file, examining
     and/or modifying lines one at a time.

\section{Text Modification Commands}
\label{Text Modification Commands}

     You can insert or delete text from the buffer using the following
     commands:

\begin {list}{}{\labelsep 20pt}

\index{[I] \tt I}

	\item [{\tt Itext\escape}]  
		Where {\tt text} is a string of ASCII  characters  terminated
             by  a  {\tt <DELIM>} character.  The specified text is inserted
             into the buffer at the current position of  the  pointer.
             The  pointer  is  positioned  immediately  after the last
             character of the insertion.

	\item [{\tt K}]       

\index{[K] \tt K}

		Delete the contents of the text buffer from  the  current
             position of the pointer up to and including the next line
             feed character.

	\item [{\tt nK}]      
		Execute the {\tt K} command  {\tt n}  times,  where  {\tt n}  is  a  signed
            integer.   A  positive  value  of  {\tt n}  causes  the {\tt n} lines
             following the pointer to be deleted.  A negative value of
             {\tt n} causes the {\tt n} lines preceding the pointer to be deleted.
             If {\tt n} is  zero,  the  contents  of  the  buffer  from  the
             beginning  of the line on which the pointer is located up
             to the pointer is deleted.

	\item [{\tt HK}]      
		Delete the entire contents of the text buffer.

	\item [{\tt D}]       

\index{[D] \tt D}

		Delete the character following the buffer pointer.

	\item [{\tt nD}]      
		Execute the {\tt D} command  {\tt n}  times,  where  {\tt n}  is  a  signed
             integer.   A  positive value of {\tt n} causes the {\tt n} characters
             following the pointer to be deleted.  A negative value of
             {\tt n}  causes  the  {\tt n}  characters preceding the pointer to be
             deleted.  If {\tt n} is zero, the command is ignored.
\end{list}

     Like the {\tt L} and {\tt C} commands, the {\tt K} and {\tt D}
	 commands may  not  execute
     across  page  boundaries.  If a {\tt K} command attempts to delete text
     up to and across the beginning or end of the buffer, text will be
     deleted  only  up  to the buffer boundary and the pointer will be
     positioned at the boundary.  No error message is  printed.   A  
	{\tt D}
     command  attempting  to  delete text past the end or beginning of
     the text buffer will produce an error  message  and  the  command
     will be ignored.

\section{Search Commands}

     The following commands may be used to search the input file for a
     specified string of characters.

\begin {list}{}{\labelsep 20pt}

	\item [{\tt Stext\escape}]  

\index{[S] \tt S}

		Where {\tt text} is a string of ASCII  characters  terminated
             by  a  {\tt <DELIM>} character.  This command searches the text
             buffer for the next occurrence of the specified character
             string  following  the  current pointer position.  If the
             string is found, the pointer is positioned after the last
             character on the string.  If it is not found, the pointer
             is positioned immediately before the first  character  in
             the buffer and an error message is printed.

	\item [{\tt Ntext\escape}]  

\index{[N] \tt N}

		Performs the same function as the {\tt S} command  except  that
             the  search  is  continued  across  page  boundaries,  if
             necessary, until the character string is found or the end
             of  the  input  file is reached.  If the end of the input
             file  is  reached,  an  error  message  is  printed.   On
             VAX/VMS,  you  can  ``back  up'' into the file and continue
             editing, although doing  so  uses  TECO  features  beyond
             those  introduced  in  this  chapter.   Using  only basic
             features (or a TECO implementation other  than  VAX/VMS),
             you  must close the output file and reopen it as an input
             file before you can edit the file further.

\end {list}

     Both the {\tt S} command and the {\tt N}  command  begin  searching  for  the
     specified  character  string  at  the  current  position  of  the
     pointer.  Therefore, neither command will locate  any  occurrence
     of  the  character  string  which  precedes  the  current pointer
     position, nor will it locate any character string which is  split
     across a page boundary.

\bigskip

     Both commands execute the  search  by  attempting  to  match  the
     command  argument,  character for character, with some portion of
     the buffer contents.  If an {\tt N} command  reaches  the  end  of  the
     buffer  without  finding  a match for its argument, it writes the
     contents of the buffer onto the output file, clears  the  buffer,
     reads  the  next  page  of  the  input  file into the buffer, and
     continues the search.

\section{Sample Editing Job}
\label{Sample Editing Job}

     The following sample editing job is included to help the new user
     to  achieve  a  greater understanding of the basic TECO commands.
     The entire terminal output from the  editing  run  is  reproduced
     intact,  with  numbers  added in the left margin referring to the
     explanatory paragraphs which follow.

\bigskip

\begin {verbatim}

     1< *EWDT1:FILE1.TXT``
     2< *HKIMR. JOHN P. JONES
      ! COMPUTER ELECTRONICS CORPORATION
      ! BOSTON, MASAASACHUSETTS
      !
      ! DEAR MR. JONES:
      !
      ! I WAS PLEASED TO RECEIVE YOUR REQUEST FOR INFORMATION
      ! PERTAINING TO THE NEW TECO TEXT EDITING AND CORRECTING
      ! PROGRAM.
      !
      ! ENCLOSED IS A COPY OF THE TECO USERS'S GUIDE, WHICH
      ! SHOULD ANSWER ALL OF YOUR QUESTIONS.
      !
      ! SINCERELY,
      !
      !
      !
      !
      ! ``
     3< *-20LSETTS` I 02150`
      ! *STION` 2C13DIREGARDING``
     4< *SGUIDE` -5DIMANUAL``
      ! *SELY` 0T``
      ! SINCERELY*0KIVERY TRULY YOURS``
      ! *HT``
      ! MR. JOHN P. JONES
      ! COMPUTER ELECTRONICS CORPORATION
      ! BOSTON, MASSACHUSETTS 02150
      !
      ! DEAR MR. JONES:
      !
      ! I WAS PLEASED TO RECEIVE YOUR REQUEST FOR INFORMATION
      ! REGARDING THE NEW TECO TEXT EDITING AND CORRECTING
      ! PROGRAM.
      !
      ! ENCLOSED IS A COPY OF THE TECO USER'S MANUAL, WHICH
      ! SHOULD ANSWER ALL OF YOUR QUESTIONS.
      !
      ! VERY TRULY YOURS,
      !
      !
      !
      !
      !
     5< *EX``
      ! (TECO is rerun, operating system dependent)
      ! *ERDT1:FILE1.TXT` EWLP:``
     6< *Y5KIMR. JAMES B. SMITH
      ! DATEK ASSOCIATES, INC.
      ! 122 MAIN STREET WEST
      ! AUSTIN, TEXAS
      !
      ! DEAR MR. SMITH:
      ! ``
      ! *HT``
      ! MR. JAMES B. SMITH
      ! DATEK ASSOCIATES, INC.
      ! 122 MAIN STREET WEST
      ! AUSTIN, TEXAS
      !
      ! DEAR MR. SMITH:
      !
      ! I WAS PLEASED TO RECEIVE YOUR REQUEST FOR INFORMATION
      ! REGARDING THE NEW TECO TEXT EDITING AND CORRECTING
      ! PROGRAM.
      !
      ! ENCLOSED IS A COPY OF THE TECO USER'S MANUAL, WHICH
      ! SHOULD ANSWER ALL OF YOUR QUESTIONS.
      !
      ! VERY TRULY YOURS,
      !
      !
      !
      !
      !
      ! *EX``

\end{verbatim}

\begin{enumerate}

  \item 
     At this  point,  the  user  called  TECO  into  memory.   TECO
     responded  by  printing an asterisk at the left margin.  The user
     then entered  an  {\tt EW}   command,  opening  an  output  file  called
     {\tt FILE1.TXT} on {\tt DT1}.  There is no input file.  Upon receipt of the
     double {\tt <DELIM>} (echoed as \escape\escape), TECO created the designated output
     file, then printed another asterisk at the left margin.

   \item
     The user entered a command string consisting of two  commands.
     The  {\tt HK}  command  cleared  the text buffer (not really necessary,
     since it was already empty), and the {\tt I} command inserted 18  lines
     of  text into the buffer, including 8 blank lines.  TECO executed
     these commands upon receipt of the  second  double  {\tt <DELIM>}
     At this  point,  the buffer pointer was positioned at the end of the
     buffer, following the last line feed character in the text.  Note
     that   the   user   made   an   error   while   typing  the  word
     {\tt MASSACHUSETTS}.  He typed {\tt MASA}, then realized his mistake  and
     struck the \fbox {DELETE} key once to delete the second {\tt A}.  
	TECO echoed
     the deleted character.  The user then typed the correct character
     and continued the insertion.

    \item

     The user typed {\tt -20L} to move the pointer to  the  beginning  of
      the  buffer  and {\tt SETTS}\escape to position 
	the pointer immediately after
     the  character  string  {\tt ETTS}   (which   terminates   the   word
     {\tt MASSACHUSETTS}).   He then used an {\tt I} command to insert one space
     and a five-digit zip code.  A second  {\tt S}  command  positioned  the
     pointer  after  the word {\tt INFORMATION}.  The {\tt 2C} command moved the
     pointer to the beginning of the next line  (carriage  return  and
     line  feed  count two characters), and the user deleted the words
     {\tt PERTAINING TO} and replaced them with the word {\tt REGARDING}.

   \item
	The user continued editing by positioning  the  pointer  after
     the  word  {\tt GUIDE}.   He  then deleted this word, and replaced it
     with the word  {\tt MANUAL}.   Finally,  he  searched  for  the  word
    {\tt SINCERELY}, typed {\tt 0T} to determine that the pointer was correctly
     positioned between the {\tt Y} and the  comma  which  follows  it,  and
     typed  {\tt 0K}  to delete everything on the line except the comma.  He
     then  inserted  {\tt VERY  TRULY  YOURS}  in  place   of   the   word
     {\tt SINCERELY}.   An {\tt HT} command caused the edited text to be printed
     at the terminal.
   
    \item
	The command string {\tt EX\escape\escape} caused the contents of the  
	buffer  to
     be written onto the output file and the output file to be closed.
     The user then reentered TECO and reopened the file {\tt FILE1.TXT} as
     an input file and specified the line printer as an output file.

   \item
	This command  string  reads  the  first  (and  only)  page  of
     {\tt FILE1.TXT}  into the buffer, deleted the first 5 lines, replaced
     them with a different address and salutation,  then  printed  the
     contents  of  the  buffer  on  the  terminal for verification and
     finally printed the new version  of  the  letter  onto  the  line
     printer.   Note  that  the  previous  version of the letter still
     resides in file {\tt FILE1.TXT} on {\tt DT1}.

\end{enumerate}

\section{Interlude}
\label{Interlude}

     The rest of this manual is a  description  of  TECO  in  all  its
     glory.  TECO is a complex editor and has many features because it
     has been under development for a long time.  (TECO is older  than
     some  of  the  readers  of this manual!) Do not try to understand
     everything the first time through.  If you find that what you are
     reading  seems  hopelessly obscure, or makes no sense whatsoever,
     skip to the next section and come back to it some time later.  It
     will be a while before you need all of TECO's features.


\bigskip

     This manual is meant to be a reference manual and not a tutorial.
     Readers  who  are  first  learning  TECO  may wish to consult the
     following document (available from Digital Equipment Corporation)
     for more basic material:  {\em DEC-10-UTECA-A-D INTRODUCTION TO TECO}.


\bigskip

     The commands described in this manual are  those  implemented  in
     TECO-11  Version  40,  TECO-8  Version  7, and TECO-10 Version 3.
     Some of the more obscure commands may not be present  under  some
     operating  systems,  in which case this is indicated by a note in
     the form {\em [Not in TECO-x]}.

\bigskip

     This manual also describes some (but not necessarily all) of  the
     obscure  commands  that  belong to one implementation of TECO but
     not to the other implementations.  Such commands are flagged by a
     note  of  the  form  {\em [TECO-x only]}.  These commands are not to be
     considered part of the so-called {\em Standard TECO} and  should  not
     be  used  in  applications  that may be run on multiple operating
     systems.  Consult also the appendices for commands that are  very
     operating system dependent.
