Google
 

Trailing-Edge - PDP-10 Archives - BB-F494Z-DD_1986 - 10,7/sed.man
There are 20 other files named sed.man in the archive. Click here to see a list.


                 TUTORIAL FOR THE SED SCREEN EDITOR
                  A Christopher Hall - August 1983
(Operating system:  TOPS-10 -- Terminal described: VT100 and [VT52])
                         TABLE OF CONTENTS

1.0  GETTING ACQUAINTED WITH SED   . . . . . . . . . . . . . . .  3
       1.1  The Viewing Window Concept   . . . . . . . . . . . .  3
       1.2  The Cursor - Where It's At   . . . . . . . . . . . .  3
       1.3  How to Talk to the Editor  . . . . . . . . . . . . .  3
2.0  HOW TO START WRITING A FILE   . . . . . . . . . . . . . . .  5
       2.1  Running the Editor   . . . . . . . . . . . . . . . .  5
       2.2  Exiting the Editor   . . . . . . . . . . . . . . . .  5
       2.3  Moving the Cursor Around   . . . . . . . . . . . . .  5
       2.4  Putting Text in the File   . . . . . . . . . . . . .  6
       2.5  Inserting and Deleting Characters  . . . . . . . . .  6
       2.6  Moving the Screen Forward and Backward in the File .  7
3.0  EDITING AN EXISTING FILE, PART 1  . . . . . . . . . . . . .  8
       3.1  Introduction to Commands and Parameters  . . . . . .  8
       3.2  On-line Help   . . . . . . . . . . . . . . . . . . .  9
       3.3  Getting Back Into Last Time's File   . . . . . . . .  9
       3.4  Rolling the Screen a Long Distance   . . . . . . . .  9
       3.5  Moving to the Beginning and End of the File  . . . . 10
       3.6  Inserting and Deleting Lines and Spaces  . . . . . . 10
       3.7  Copying or Moving Lines of Text  . . . . . . . . . . 11
4.0  EDITING AN EXISTING FILE, PART 2  . . . . . . . . . . . . . 13
       4.1  Compiling After Exiting  . . . . . . . . . . . . . . 13
       4.2  Searches   . . . . . . . . . . . . . . . . . . . . . 13
       4.3  Setting Tabs - Word-wise Tab and Backtab   . . . . . 13
       4.4  Inserting Text in the File Using <PUT>   . . . . . . 14
       4.5  Changing Files while Editing   . . . . . . . . . . . 15
       4.6  Recovering Deleted Stuff . . . . . . . . . . . . . . 16
5.0  EDITOR GOODIES  . . . . . . . . . . . . . . . . . . . . . . 17
       5.1  Defining Parameters by Moving the Cursor   . . . . . 17
       5.2  Moving a Given Percent of the Way Through the File . 18
       5.3  <SWITCH>: Setting Switches or Querying Status  . . . 18
       5.4  <ERASE-LINE>: Erase from Cursor to End of Line   . . 20
       5.5  How to Edit Parameters   . . . . . . . . . . . . . . 20
6.0  MORE EDITOR GOODIES   . . . . . . . . . . . . . . . . . . . 21
       6.1  Marking Positions in the File  . . . . . . . . . . . 21
       6.2  Rectangular Insert/Delete Spaces   . . . . . . . . . 21
       6.3  Tokens   . . . . . . . . . . . . . . . . . . . . . . 21
       6.4  Picking or Deleting a Lot of Stuff   . . . . . . . . 22
       6.5  Scanning   . . . . . . . . . . . . . . . . . . . . . 22
       6.6  Changing the Case of Characters  . . . . . . . . . . 22
       6.7  Setting or Clearing the Split-Screen Window  . . . . 23
       6.8  Erasing Words From the File  . . . . . . . . . . . . 23
       6.9  Substituting (Search and Replace)  . . . . . . . . . 23
7.0  USEFUL COMMANDS FOR SPECIAL CASES   . . . . . . . . . . . . 25
       7.1  What to Do if the File is Wide   . . . . . . . . . . 25
       7.2  How to Put Control Characters in the File  . . . . . 25
       7.3  Many Ways to Save the File   . . . . . . . . . . . . 25
       7.4  Repairing a Fragged Screen   . . . . . . . . . . . . 26
       7.5  Justifying Text  . . . . . . . . . . . . . . . . . . 26
       7.6  Repeating Commands or Inventing Your Own   . . . . . 27
       7.7  Setting Up Default Switches in SWITCH.INI, SED.INI . 26
                               - 1 -


1.0  GETTING ACQUAINTED WITH SED

     This document  describes  the  screen  editor  SED.   It  is  a
tutorial  which  introduces  a  new  editor  user  gradually  to the
features of the editor.   The  first  sections  give  only  as  much
information  as  you  need to get started;  later sections introduce
you to the full power of SED.

     This tutorial does not give a complete description of SED.   In
fact,  if  you  never  go  beyond  it  you  will  miss  a lot of the
interesting and  useful  editor  features.   The  reference  manual,
DOC:SED.DOC,  is a complete description of all the editor functions.
When you have mastered the contents  of  this  tutorial  you  should
consult the reference manual.



1.1  THE VIEWING WINDOW CONCEPT

     SED thinks of a text file as if it were a scroll of  writing  -
lots  and  lots  of  lines of text, one line after another.  The CRT
terminal screen is like a magnifying glass held over the scroll:  it
shows  a  certain number of lines and a certain number of characters
per line, but the file may extend beyond the limits of the glass  on
all  sides.   Like  the magnifying glass, the terminal screen can be
moved forward, backward, left, or right over the file.

     The terminal screen is called the  "viewing  window"  into  the
file.   Moving  the window forward or backward in the file is called
"rolling" the  window,  and  moving  it  left  or  right  is  called
"sliding".



1.2  THE CURSOR - WHERE IT'S AT

     The cursor is the blot or blinking dash that is always  present
on the terminal screen.  It represents your position in the file you
are editing.  If you type a character it appears where the cursor is
and  the  cursor  moves  one  space  to the right.  You can move the
cursor anywhere you like on the screen.



1.3  HOW TO TALK TO THE EDITOR

     You can do three types of things with SED:   put  text  in  the
file,  move  the  cursor  around, and issue editor commands.  Editor
commands do such things as insert blank lines  or  spaces  into  the
text,  move  the  viewing  window  around,  and  search  for things.
Descriptions of the various  commands  make  up  the  bulk  of  this
tutorial.


                               - 2 -


     You issue a command by typing a control  character,  a  special
key, or an escape sequence.  You type a control character by holding
down the button labeled  "CTRL"  and  pressing  a  letter  key  (for
example, to get a ^T press "CTRL" and "T").

     Special keys are keys which are off to the side of  the  normal
keyboard.   Not all terminals have them, and how many and where they
are vary from terminal to terminal.  The program you are running can
say  what  action  will be taken when a special key is pressed.  The
editor understands special keys to be commands.  But which  commands
depends on the installation.  See the terminal-dependent information
or ask a systems person.

     You get an escape sequence by typing the "ESCAPE" or  "ALTMODE"
character  followed  by  some  other  character.   For  example, the
command <INSERT-MODE> might  be  invoked  by  the  sequence  ESC  Q,
meaning  that the user should type the two characters ESCAPE and "Q"
to get the <INSERT-MODE> command.




































                               - 3 -


2.0  HOW TO START WRITING A FILE

     To get started with SED you only need to know how to  put  text
into  your  file  and how to reach parts of the file which are below
the bottom or above the top of the screen.  This section covers  the
following topics:

        RUNNING AND EXITING THE EDITOR
        MOVING THE CURSOR AROUND
        TYPING TEXT INTO THE FILE
        INSERTING AND DELETING CHARACTERS
        MOVING THE SCREEN FORWARD AND BACKWARD IN THE FILE



2.1  RUNNING THE EDITOR

     Run SED by typing:

        .R SED;FILE.EXT         or
        .R SED;FILE.EXT=

     Either form will find the given file (in this  case,  FILE.EXT)
if  it exists.  If the file does not exist, the first form will give
you a "File not found" error message;  the second form  will  create
the file and let you edit it.

     Also, switches can be included along with the  filespecs.   The
switches  are  described  under  the  <SWITCH>  command, which comes
later.  In any case, the syntax is ".R SED;FILE.EXT/SWITCH/SWITCH".



2.2  EXITING THE EDITOR

     Exit SED by typing <EXIT> (^Z) to save your editing session  or
<ABORT> (^C) to forget it.

     <EXIT> will save all the changes you have made  in  your  file.
The file will be "backed up", that is, a copy of the file the way it
was before the editing session will be saved.  The backup  file  has
the same name as the regular file, and the extension .BAK.

     <ABORT> exits the editor and leaves the file  the  way  it  was
before editing began.



2.3  MOVING THE CURSOR AROUND

     The cursor is the blinking dash or blot on the screen.  If  you
type a character it appears where the cursor is and the cursor moves
one place to the right.  While  editing  the  cursor  can  be  moved
anywhere  on  the  screen  without  changing your file.  Then when a
character is typed it will appear where the cursor is, both  on  the
                               - 4 -


screen and in the file.

     The cursor can be moved up, down, left, and right by typing one
of  the  keys  with  an  arrow  on  it.   The direction of the arrow
indicates the direction which the cursor will move.  There is also a
way  to move the cursor "home", which means the upper left corner of
the screen;  type PF3 [KEYPAD-BLACK].

     There  are  other  cursor  moving   commands.    <RETURN>   (or
<CARRIAGE-RETURN>)  moves  the cursor to the start of the next line.
The <TAB> key (and ^I) moves to the next tab stop (tab stops are set
to be every 8 characters).  And <BACKTAB> (^U) moves to the previous
tab stop.

     There are four more cursor movers.  <BEG-LINE>  (KEYPAD-4)  and
<END-LINE>  (KEYPAD-6)  move  to  the beginning and end of the line,
respectively.  <UP-TAB> (KEYPAD-8) moves up  six  lines  as  if  you
typed  six  <CURSOR-UP>s.   And <DOWN-TAB> (KEYPAD-2) moves down six
lines.

     Some implementations of SED may use  the  <LINE>  command  (not
implemented)  in  place  of <BEG-LINE> and <END-LINE>.  <LINE> moves
the cursor to the start of the line it is on.  If the cursor already
is  at  the start of the line, <LINE> will move it to the end of the
line.  So <LINE><LINE> will usually get you to the end of the line.



2.4  PUTTING TEXT IN THE FILE

     To put text in the file, just type it.  The  text  will  appear
where  the  cursor  is.   Use the cursor movement commands described
above to move the cursor to the location on  the  screen  where  you
want  the text to be.  The editor makes sure that the screen and the
file always look the same.

     To replace one character with another, move the cursor  to  the
offending  character  and type the correct one on top of it.  That's
all there is to it.

     There are ways of inserting words in the middle  of  lines  you
have already typed, of breaking a line in two or combining two lines
into one, of  inserting  blank  lines,  and  of  deleting  lines  or
characters  that  are  not  wanted.   All  of  these, and a lot more
besides, will be covered in later sections of this tutorial.



2.5  INSERTING AND DELETING CHARACTERS

     If you want to insert a  word  between  two  other  words  type
<INSERT-MODE>  (KEYPAD-ENTER).  Then characters you type, instead of
replacing the ones in the file, will be inserted  where  the  cursor
is.  The rest of the line will move to the right as you type.
                               - 5 -


     You can get out of insert mode and back into  replace  mode  by
typing <INSERT-MODE> again.

     You  can  delete  the  character  you  just  typed  by   typing
<DELETE-CHARACTER>  (BACKSPACE).   The  character to the left of the
cursor will be deleted from the line.  If that character is  a  tab,
the entire tab is deleted.  If the cursor is at the start of a line,
<DELETE-CHARACTER> has no effect.

     There are other ways both to insert and to delete text.   These
will be covered later.



2.6  MOVING THE SCREEN FORWARD AND BACKWARD IN THE FILE

     If you type on the bottom line of the screen and  then  type  a
carriage  return  the  screen  will roll one line.  That is, the top
line disappears, the other lines move up, and a blank  line  appears
at  the  bottom.   The  top line has not been deleted;  it is simply
above the viewing window.

     You can get the lines above the viewing window back  by  typing
<ROLL-BACKWARD-LINES>  (^W).   This command does the opposite of the
above:  lines disappear from the bottom, the  remaining  lines  roll
down,  and  lines  which  were  above  the screen appear at the top.
<ROLL-BACKWARD-LINES> will attempt to roll about  8  lines,  but  it
won't go farther than the beginning of the file (so if you're at the
start of the file and type the command nothing will happen).

     Similarly, you can roll the screen forward  about  8  lines  by
typing the <ROLL-FORWARD-LINES> command (^T).






















                               - 6 -


3.0  EDITING AN EXISTING FILE, PART 1

     The preceding section did nothing more than  get  you  started.
You  can  do  a  lot  more than just typing, inserting, and deleting
text.  This section gives you a taste of the full power of SED.

     These topics are covered in this section:

        INTRODUCTION TO COMMANDS AND PARAMETERS
        ON-LINE HELP
        EDITING LAST TIME'S FILE
        ROLLING THE SCREEN A LONG DISTANCE
        MOVING TO THE BEGINNING AND END OF THE FILE
        INSERTING OR DELETING LINES OR SPACES
        COPYING OR MOVING LINES OF TEXT



3.1  INTRODUCTION TO COMMANDS AND PARAMETERS

     You know how  do  roll  the  screen:   just  type  one  of  the
<ROLL-LINES>   commands,  ^T  for  <ROLL-FORWARD-LINES>  or  ^W  for
<ROLL-BACKWARD-LINES>.   Actually,  there's  more  to  the   general
command format than that.

     Each command takes a parameter, which is a value or string used
by  the  command.   For  example, the parameter for the <ROLL-LINES>
commands above is the number of lines to roll.  Initially there is a
default  parameter,  in  this case, 8 lines.  But you can change the
parameter to be any (positive) value you want;  the screen will then
roll that many lines until you change the value again.

     To give a parameter to a command, type

        <ENTER><parameter><COMMAND>

The word <ENTER> means that you press the <ENTER-PARAMETER> key (PF1
[KEYPAD-BLUE]).  By doing so you tell SED that what you are about to
type is a command parameter, not a piece of text.

     <Parameter> is whatever value you want to give to  the  command
(don't type the angle brackets).  It could be the number of lines or
spaces to do something with, the key to search for, or the  text  to
insert,  depending  on what the command expects.  As each command is
explained its parameters will be described.

     <COMMAND> is the command;  the control character, special  key,
or escape sequence which does the job you want.

     You can even edit parameters.  <CURSOR-LEFT>  will  delete  the
most  recent character typed;  <BACKTAB> (^U) will delete the latest
word;  and <ERASE-LINE> (^J) will delete the entire  parameter.   To
kill  the  entire  parameter  and  get  out  of ENTER mode, type the
<RESET> command (RUBOUT or DELETE).
                               - 7 -


     So if you want the screen to roll 4 lines at a time, type

        <ENTER>4<ROLL-FORWARD-LINES>

where <ENTER> is PF1 [KEYPAD-BLUE] and <ROLL-FORWARD-LINES>  is  ^T.
The  screen will roll 4 lines.  If you want to roll another 4 lines,
just type

        <ROLL-FORWARD-LINES>

     Certain pairs of commands share a single parameter.  If you set
up to roll forward 4 lines at a time, you will roll backward 4 lines
too.  This sharing is done where it is natural  and  expected,  like
the key for searching forward or back, the number of lines to insert
or delete.



3.2  ON-LINE HELP

     You can  get  information  about  any  command  while  you  are
editing.  Type <HELP> (KEYPAD-3), or <ENTER> twice, then the command
you want help with.  Try it.

     <HELP><HELP> gives a diagram of how SED's commands are laid out
on the terminal.



3.3  GETTING BACK INTO LAST TIME'S FILE

     You don't have to tell SED which file you want  to  edit  every
time.  Say you were editing THING.GIG and you exited, then later you
want to make some more changes to THING.GIG.  You only have to type

        .R SED

and you will be back in THING.GIG.  In fact, you will be set  up  at
the exact page and cursor position that you were at when you exited.
You don't have to start at the beginning of the file each  time  you
edit it.



3.4  ROLLING THE SCREEN A LONG DISTANCE

     You can now roll the screen forward or backward any  number  of
lines you want.  However, if the file is long and you want to get to
a place several screens-full away, it would be awkward to figure out
how   many  lines  to  roll.   There  are  two  other  commands  for
long-distance rolls:  <ROLL-FORWARD-PAGES> and <ROLL-BACKWARD-PAGES>
(^Y  and  ^A).  A page is defined as one screen-full of lines (about
24).

                               - 8 -


     So if you type <ROLL-FORWARD-PAGES> the entire screen  will  be
rewritten, and the new line at the top of the screen will be the one
beneath the line previously at the bottom of the screen.

     The parameter to the <ROLL-PAGES> commands is,  naturally,  the
number  of  pages  to  roll.   It is shared by the two commands (ie,
setting it for one sets it for the other, too).



3.5  MOVING TO THE BEGINNING AND END OF THE FILE

     There are easy ways to get to the beginning and the end of your
file.  To get to the beginning type

        <ENTER>0<PERCENT-GOTO>

where the <PERCENT-GOTO> command is ^P.  To get to the end type

        <ENTER><PERCENT-GOTO>

that is, just <ENTER> and the command, with no parameter.

     The full implications of the  <PERCENT-GOTO>  command  will  be
covered later.



3.6  INSERTING AND DELETING LINES AND SPACES

     So far, as long as you have been typing stuff  into  your  file
things  have  been all right.  But suppose you wanted to add a word,
or even a line of text, in the middle of what  you'd  already  done?
This   section   shows   you   two   commands,  <INSERT-SPACES>  and
<INSERT-LINES>, which add air holes to your file, and two  commands,
<DELETE-SPACES> and <DELETE-LINES>, which remove unwanted stuff from
the file.

     The <INSERT-SPACES> command is ^K.  It inserts a space in  your
file  where  the cursor is.  The parameter to <INSERT-SPACES> is the
number of spaces to insert.

     <DELETE-SPACES> (^L) deletes characters (not just spaces) where
the cursor is.  It shares its parameter with <INSERT-SPACES>.

     The <INSERT-LINES> command (^D) inserts a blank line where  the
cursor  is.   If the cursor is not at the left margin the line it is
on will be broken in two at the cursor position.  The  parameter  to
<INSERT-LINES> is the number of lines to insert.

     <DELETE-LINES> (^F) does the opposite  of  <INSERT-LINES>,  and
shares  its  parameter.   If you delete something accidentally using
<DELETE-LINES>, you can get it back by typing

                               - 9 -


        <ENTER><PUT>

where the <PUT> command is ^G.  <PUT> does a lot of things;  it will
be described in gruesome detail later.

EXAMPLES

     Say  the  cursor  is  at  the  "f"  of  "five"  and  you   type
<INSERT-SPACES>:

BEFORE:         Pack my box with five dozen liquor jugs.

AFTER:          Pack my box with  five dozen liquor jugs.

     You then type <ENTER>3<DELETE-SPACES>:

AFTER:          Pack my box with ve dozen liquor jugs.

     You type <INSERT-LINES>:

AFTER:          Pack my box with
                ve dozen liquor jugs.

     Then you type a <CARRIAGE-RETURN> to get to the  "v"  and  type
<ENTER>2<INSERT-LINES>:

AFTER:          Pack my box with


                ve dozen liquor jugs.



3.7  COPYING OR MOVING LINES OF TEXT

     SED has two buffers which hold text from the file:  the  delete
buffer  and the pick buffer.  "Deleting" text means removing it from
the file and putting it in the delete buffer;  "picking" text  means
loading  it  into  the pick buffer without changing the edited file.
The contents of either buffer can be inserted anywhere in the  file,
or in another file if you wish.

     You have already met the delete command:  <DELETE-LINES>  (^F).
Its parameter is the number of lines to remove (you can remove parts
of lines, too.  See the reference manual, but don't worry  about  it
until you are comfortable with the editor).  You can put those lines
back in the file by typing <ENTER><PUT> (the <PUT> command is ^G).

     To pick up lines of the file, that is, to load the pick  buffer
but  not  affect  the  file,  use  the <PICK> command (^V).  As with
<DELETE-LINES>, the parameter is the number of lines  to  pick.   To
insert the lines back in the file, type just <PUT>.


                              - 10 -


     Thus <PUT> is the command which writes out the pick  or  delete
buffer.   <PUT>  writes  the pick buffer and <ENTER><PUT> writes the
delete buffer.  Use the <PICK> command to duplicate lines from  your
file;  use <DELETE-LINES> to move stuff from one place to another.


















































                              - 11 -


4.0  EDITING AN EXISTING FILE, PART 2

     This section describes more useful commands, plus a  couple  of
new features of commands you already know.  Wir handlen:

        COMPILING AFTER EXITING
        SEARCHES
        SETTING TABS - WORD-WISE TAB AND BACKTAB
        INSERTING TEXT IN THE FILE USING <PUT>
        CHANGING FILES WHILE EDITING
        RECOVERING DELETED STUFF



4.1  COMPILING AFTER EXITING

     If you exit by typing <ENTER><EXIT> SED will save your file and
execute  your  latest  compile-class  command (COMPILE, LOAD, DEBUG,
EXECUTE, etc.).



4.2  SEARCHES

     You can search for any text string by typing

        <ENTER><string><SEARCH-FORWARD>

where <string>  is  your  search  key  (without  the  brackets)  and
<SEARCH-FORWARD>  is  ^R.  The file will be searched from the cursor
position  to  the  end  (if  necessary),  and  the  cursor  will  be
positioned  at  the  start  of  the  next  occurrence  of  <string>.
Similarly you can search from the cursor position backwards  to  the
beginning of the file using the <SEARCH-BACKWARD> command (^E).

     You can abort a losing search by typing RUBOUT.

     You can set up the current search key as a parameter by  typing
<ENTER>S<RECALL>  (<RECALL> is PF2 [KEYPAD-RED]).  You can then edit
the key and use it for another search (or as the parameter  for  any
other command).  Likewise, typing <ENTER>O<RECALL> will get back the
previous search key.

Hint:  Searches will go faster if the first character of the key  is
infrequent  in  the file.  If you want to look for "EXEC" in a large
file, try "XEC" instead.



4.3  SETTING TABS - WORD-WISE TAB AND BACKTAB

     Tab stops are set every 8 positions.  You can change them to be
any  constant  interval by typing <ENTER>T:n<SWITCH> (where n is the
interval and <SWITCH> is ^N).  You can also set or clear  a  tab  in
any  column.  To set the tab, move the cursor to the column and type
                              - 12 -


<TAB-SET>  (<TAB-SET>  is  ESC-S).    To   clear   the   tab,   type
<ENTER><TAB-SET>.

     (<ENTER>D<TAB-SET> displays a ruler containing the current  tab
settings on the bottom line of the screen).

     <TAB> and <BACKTAB> can also be set up to move to the start  of
the  next  (or  previous)  word  or to the end of a line.  To set up
these "word-wise" tabs, type

        <ENTER>T:W<SWITCH>

where "T:W" are the three characters T, :, W;  and <SWITCH>  is  ^N.
<SWITCH>  is  a  command  which  sets  editor  switches, and you are
telling it that you want word-wise tabs.  You can get  regular  tabs
back by typing <ENTER>T<SWITCH> or <ENTER>T:R<SWITCH>.

     When you have set up word-wise tabs, you will get the following
effects:

CURSOR AT:           <TAB> MOVES TO:         <BACKTAB> MOVES TO:

within the line      start of next word      start of previous word
start of line        start of next word      end of previous line
last word of line    end of line             start of previous word
beyond end of line   next 8-space tab stop   start of last word of line

Word-wise tabs are a lot more fun than regular tabs.



4.4  INSERTING TEXT IN THE FILE USING <PUT>

     You can already  insert  text  by  using  <INSERT-MODE>  or  by
opening  up  a  hole  using <INSERT-SPACES> and then typing the text
over the hole.  However,  the  easiest  way  is  to  use  the  <PUT>
command.  Type

        <ENTER><string><PUT>

where <string> is whatever you want to insert and <PUT> is ^G.  This
has  the  same  effect  as opening spaces and typing over them.  The
string is inserted where the cursor is.

     Furthermore, the editor remembers the string, so if you want to
put it somewhere else you can move there and type <PUT> and the same
string will be inserted at the new location.







                              - 13 -


4.5  CHANGING FILES WHILE EDITING

     If you are editing a file and you want to  do  something  to  a
second file, you can get to it by typing

        <ENTER><file2><SET-FILE>

where <file2>  is  the  filespecs  for  your  second  file  and  the
<SET-FILE>  command  is  ^B.   SED  will  save  the  first file (but
remember where you are) and display the first  page  of  the  second
file  for  editing.  You can return to the first file by typing just
<SET-FILE>.  Then you can get back to  the  second  file  by  typing
another <SET-FILE>.

     You can even toggle back and forth between two positions in the
same file.

     When you exit SED your positions in both files are remembered.

     If you do not give an extension in your filespecs SED will  try
several  as  defaults.   First  it will try to find the file with no
extension.  If that fails it will use the device  as  the  extension
(so  if your filespec is "HLP:DIRECT" SED will try "HLP:DIRECT.HLP".
If you don't give a device (or if the device is DSK:) this  step  is
skipped.

     Next SED will try the extension  of  the  file  you  were  last
editing.   If  you  were editing FOO.BAR and your filespec is "SAND"
SED will look for "SAND.BAR".  Thus you  can  jump  around  among  a
family of files by typing only the file name.

     If  all  this  fails  SED  will  try  each  of  the   following
extensions:  MAC, TXT, RNO, FOR, CBL, DAT.  If all of these fail you
will (finally) get the "File not found" error message.

     <SET-FILE> understands SFD's, and has it's own way of  deciding
SFD defaults (as described in the reference manual).

     The name of the file being edited  can  be  changed  using  the
/OUT:  switch.  For example, typing

        <ENTER>FOO.BAR/OUT:FUBAR.MAC<SET-FILE>

will set up FOO.BAR for editing.  The file will be saved  (on  exit,
another  <SET-FILE>,  the <SAVE-FILE> command, or incremental saves)
as FUBAR.MAC.  Also, the name of the current file  can  be  changed,
for example, by:

        <ENTER>OUT:THING.GIG<SWITCH>

(<SWITCH> is ^N).  This will change the name of the current file  to
THING.GIG.


                              - 14 -


     There are also other switches which apply  to  <SET-FILE>,  and
other  useful features.  See the <SET-FILE> and <SWITCH> sections of
the reference manual, DOC:SED.DOC, for details.



4.6  RECOVERING DELETED STUFF

     The  commands  <DELETE-LINES>   (^F),   <DELETE-SPACES>   (^L),
<ERASE-LINE>  (^J),  <ERASE-WORD> (KEYPAD-.), and <DELETE-CHARACTER>
(BACKSPACE)  remove  text  from  the  file.   If  you  delete   text
accidentally  using  any  of  these  commands,  you can get it back.
<DELETE-LINES> can be recovered  from  by  typing  <ENTER><PUT>,  as
described  in  a  previous  section.   The  text from the other four
commands can be recovered by typing <ENTER><HELP>.







































                              - 15 -


5.0  EDITOR GOODIES

     Now you know nearly all the essentials of  SED.   The  rest  of
this  tutorial  deals  with  things  that  can  make your life a lot
easier, but which do not give you anything really new.  There's even
more  fun  stuff  that isn't covered here.  See the editor reference
manual for all the bells and whistles.

     Here you will find:

        DEFINING PARAMETERS BY MOVING THE CURSOR
        MOVING A GIVEN PERCENT OF THE WAY THROUGH THE FILE
        <SWITCH>: SETTING SWITCHES OR QUERYING STATUS
        ERASING TO THE END OF A LINE
        HOW TO EDIT PARAMETERS



5.1  DEFINING PARAMETERS BY MOVING THE CURSOR

     You don't need to know how to count in order  to  issue  editor
commands.   Instead  of  typing,  say,  <ENTER>7<DELETE-SPACES>, you
could type <ENTER> and then move the cursor over the characters  you
want   to   delete  (using  <TAB>  or  <CURSOR-RIGHT>).   Then  type
<DELETE-SPACES>, and the stuff between where the cursor started  and
where  it ended will be deleted.  This method of passing a parameter
to a command is called "cursor movement." It is often a  lot  easier
to use than counting.

     When you initiate cursor movement the editor  will  type  "Parm
defined  by  cursor  movement"  at  the  bottom  of  the screen as a
reminder.

     Cursor movement works across a span of lines,  too,  and  often
can  cover  a  change of both lines and spaces.  For example, if the
cursor   were   at   the   "b"    in    "box"    and    you    typed
<ENTER><CARRIAGE-RETURN><TAB><TAB><INSERT-LINES>,  you  would insert
one blank line and 16 spaces into the file:

BEFORE: Pack my box with five dozen liquor jugs.
        This is the thing of the gig
        and the gig is where it's at.

AFTER:  Pack my
                box with five dozen liquor jugs.
        This is the thing of the gig
        and the gig is where it's at.

     In this example the same thing could have been done  by  typing
<ENTER><CURSOR-DOWN><INSERT-LINES>.

     Any key that moves the cursor can be used for a cursor movement
parameter.   SED  looks only at where the cursor starts and where it
ends up;  It does not know how the cursor gets there.  It  does  not
matter  what the cursor passes over on the way.  So the quickest way
                              - 16 -


of getting the cursor where you want it is the best (an easy way  to
get to the bottom of the screen is to type <HOME><CURSOR-UP>).



5.2  MOVING A GIVEN PERCENT OF THE WAY THROUGH THE FILE

     The <PERCENT-GOTO> command (^P) was touched upon as  the  means
of getting to the start or the end of the file.  Actually, it can be
used to move to any amount of the way through the file.  Typing

        <ENTER>37<PERCENT-GOTO>

will display a page of the file that is about 37% of the way through
it.  The beginning of the file is 0%;  the end is 100%.  A shorthand
way of asking for the end of the file is to type simply

        <ENTER><PERCENT-GOTO>



5.3  <SWITCH>: SETTING SWITCHES OR QUERYING STATUS

     The <SWITCH> command (^N) has two uses.  The first  is  to  set
switches  to  get  SED  to perform the way you want it to.  You have
already seen the /TABS switch, which sets up  word-wise  or  regular
tabs.   The  other  function  of  <SWITCH> is to display information
about the file you  are  editing  or  the  setting  of  the  nominal
parameters.

     Switches can also be given when running SED, or  in  SWITCH.INI
or SED.INI.

     To get file status information, just type  <SWITCH>  without  a
parameter.  The editor will write on the bottom of the screen a line
which looks like:

FILE: *SED.RNO[100,105]  LINE: 534(67%) POS'N: 1 ALT: FOO.BAR[100,105]

This line says that the current file is SED.RNO (the  "*"  indicates
that  SED.RNO  has been modified), the cursor is at the start of the
534th line, which is 67% through the file, and the alternate file is
FOO.BAR.

     To find out what  the  nominal  parameters  are  set  to,  type
<ENTER><SWITCH>.  This will give you a line like:

RL:8 RP:1 PC:2 SL:8 IL:1 IS:8 PK:3,8 CS:1 SU:5 TB:8; KEY:th SUB:FOO






                              - 17 -


     This message tells you that the following values are set:

        LINES TO ROLL:         8
        PAGES TO ROLL:         1
        PERCENT-GOTO:          2
        SLIDE:                 8
        INSERT/DELETE LINES:   1 LINE AND 0 SPACES
        INSERT/DELETE SPACES:  8
        PICK:                  3 LINES AND 8 SPACES
        CHANGE-CASE PARAMETER: 1
        NUMBER OF SUBSTITUTES: 5
        TAB SIZE:              8
        SEARCH KEY:            th
        SUBSTITUTE STRING:     FOO

     So if you type a <PERCENT-GOTO> command with no  parameter  you
will  go  to  the 2% point, a <DELETE-LINES> will delete 1 line (and
<INSERT-LINES> will insert 1 line), and a  <PICK>  will  pick  up  3
lines.

     There are a number of switches which you can set to tailor  SED
to  your own tastes.  Here are the most useful ones.  See the editor
reference  manual,  DOC:SED.DOC,  for  a  description  of  all   the
switches.

AGAIN:n edit the same file again, n percent through
BACKUP  make a backup file on exit
CASE    make searches case-dependent ("THE" is different from "the")
CREATE  always create file if not found with <SET-FILE> or RUN command
GOTO:n  on a SET-FILE or initial run, start n percent into the file
LENG:n  make SED think the terminal is n lines long
QUICK   don't display the file on startup or <SET-FILE>
READ    make the file read-only (file-altering commands are illegal)
ISAVE:n do an incremental save every n commands
RESET   reset parameters to their starting values after each command
SAVE:n  do an incremental save every n characters of type-in
STRIP   strip off SOS line numbers before editing a file
TABS:n  set tabs to be every n spaces, or set up word-wise tabs
WIDTH:n make SED think the terminal is n spaces wide

     SED  starts   with   BACKUP/CASE/NOISAVE/NOSAVE/NOSTRIP/TABS:8.
LENGTH and WIDTH are the dimensions of your terminal.

     Typing NOSWITCH will negate the effect described above.  NOBACK
will  cause no backup file to be made, and NOCASE will make searches
be case-independent.  NOGOTO doesn't make sense, but probably parses
as the same as GOTO.

     Ideas:  /TABS:W is more fun than /TABS.  If you don't like  the
clutter  of  .BAK files, set /NOBACK in SWITCH.INI or SED.INI.  Then
set /BACK only when you are editing a file and you want an  unedited
copy.  To look at a file and ensure it won't be changed use /READ in
the <SET-FILE> or monitor run command.

                              - 18 -


5.4  <ERASE-LINE>: ERASE FROM CURSOR TO END OF LINE

     The <ERASE-LINE> command (^J) deletes all characters  from  the
cursor  position  to the end of the line.  It performs exactly as if
you typed <ENTER>1000<DELETE-SPACES>.

     In a parameter <ERASE-LINE> can be used to  delete  the  entire
parameter or cancel cursor movement.

     Typing <ENTER><HELP> will recover an erroneously erased line.



5.5  HOW TO EDIT PARAMETERS

     If you make a mistake while typing a parameter you can  correct
it in a number of ways.  In a parameter,

TO DELETE THE        TYPE                (KEY:)
    latest character   <CURSOR-LEFT>         LEFT
                       <DELETE-CHARACTER>    BACKSPACE
    latest word        <BACKTAB>             ^U
                       <ERASE-WORD>          KEYPAD-.
    entire parameter   <ERASE-LINE>          ^J

Also, to forget the  parameter  entirely  type  <RESET>  (RUBOUT  or
DELETE).

     Here's another useful feature:  Suppose you type

        <ENTER>LABEL1:<SEARCH-FORWARD>

and then realize you wanted to search  for  "LABEL",  not  "LABEL:".
You  can  abort  the search by typing RUBOUT (for your information).
Then type the <RECALL> command (PF2 [KEYPAD-RED]), which displays on
the bottom line

        >LABEL1:

You can then type  a  <CURSOR-LEFT>  to  get  rid  of  the  ":"  and
<SEARCH-FORWARD> to go hunt for "LABEL".

     Thus the <RECALL> command acts just as  if  you  typed  <ENTER>
followed  by  the latest parameter you typed.  It is useful in three
instances:  when you typed an almost-right parameter, when you typed
the  right parameter but the wrong command, and when you want to see
what the heck that last parameter was.







                              - 19 -


6.0  MORE EDITOR GOODIES

     Here are a couple more conveniences that you  will  wonder  how
you ever got along without:

         MARKING POSITIONS IN THE FILE
        RECTANGULAR INSERT/DELETE SPACES
        TOKEN PARAMETERS
        <PICK>ING OR <DELETE>ING A LOT OF STUFF
        SCANNING
        CHANGING THE CASE OF CHARACTERS OR STRINGS
        SETTING OR CLEARING THE SPLIT-SCREEN WINDOW
        ERASING WORDS FROM THE FILE
        SUBSTITUTING (SEARCH AND REPLACE)



6.1  MARKING POSITIONS IN THE FILE

     If you are reading a listing and want to look up  a  subroutine
in  another  part  of  the program, you might put a bookmark at your
current position.  In SED, you'd use the <MARKER> command (ESC-M).

     <MARKER> is also used to move to a previously-set  marker,  and
to name, delete (kill), and list the names of the current markers.

     There are 11 markers.  All except one  (the  "default"  marker)
must  be named.  The default marker is easy to work with but doesn't
have a name.

Type:                 To:
  <MARKER>              Set the default marker at current position
  <ENTER><MARKER>       Go to the default marker
  <ENTER>Sname<MARKER>  Set marker named "name" at current position
  <ENTER>Gname<MARKER>  Go to marker "name"
  <ENTER>Kname<MARKER>  Kill (delete) marker "name"
  <ENTER>K*<MARKER>     Kill all markers
  <ENTER>N<MARKER>      List the currently-defined marker names

     If you add or delete text in the file the  marker  may  move  a
little;   if  so,  it  will  usually be earlier in the file that you
expect.



6.2  RECTANGULAR INSERT/DELETE SPACES

     Say you have a diagram which you want to  move  to  the  right.
You  could do an <INSERT-SPACES> command on each line the diagram is
on.  Or you could save yourself some typing by opening  a  rectangle
of spaces, as follows.

     Move the cursor to the first line and type <ENTER>.   Move  the
cursor right as many spaces as you want to open (this is, of course,
a cursor movement parameter).  Move the cursor  down  past  all  the
                              - 20 -


lines  you  want to act upon (they must all be on the screen).  Then
type <INSERT-SPACES>.

     You  defined  a  rectangle  whose  opposite  corners  were  the
starting  and ending positions of the cursor, and that rectangle got
filled up with spaces, pushing everything over.

     The same sort of thing happens with <DELETE-SPACES>, except, of
course, the interior of the rectangle is deleted from the file.



6.3  TOKEN PARAMETERS

     Sometimes the parameter you want is looking up at you from  the
terminal  screen.   Instead  of  typing  it  you  can  have pick the
parameter up from the file.  Such a parameter is called a token.

     To get a token parameter, position the cursor at the  start  of
the  thing  you  want and type <ENTER><COMMAND> (fill in the desired
command).  Either the "word" at the cursor location or the length of
that  word  will  be  taken as the command's parameter.  A "word" is
defined to be the text starting at the cursor and extending  to  the
first non-alphanumeric character.

     If the command takes a numeric parameter the size of the  token
is  used, otherwise the actual string will be used.  For example, to
delete  a  word  from  the   file,   position   to   it   and   type
<ENTER><DELETE-SPACES>.   To  search  for  the  word  at  the cursor
position type <ENTER><SEARCH-FORWARD>.

     Not all commands  allow  token  parameters.   You've  seen  the
<PERCENT-GOTO>  and  <PUT>  commands,  where  <ENTER><COMMAND> has a
special non-token meaning.  However, in general  if  a  token  makes
sense for a command it is legal.  Experiment and see what happens.



6.4  PICKING OR DELETING A LOT OF STUFF

     Using the <MARK> (KEYPAD-7) command, you can mark your  current
position  in  the  file,  move  forward  or  backward  to  any other
position, and do a <PICK> or <DELETE-LINES> which will affect all of
the  text  between the mark and the ending cursor position.  You can
use <ROLLS>, <SEARCHES>, <PERCENT-GOTO>, or any other command  which
does  not  modify  the file, to get to the other end of the text you
want to work with.  The <PICK>ed or <DELETE>d text can be <PUT> back
in the file in the normal fashion (by typing <PUT> or <ENTER><PUT>).

     The MARK command thus changes the  action  of  the  <PICK>  and
<DELETE-LINES>  (with no parameter) commands.  After <MARK> is typed
and until the file is modified, <PICK> or <DELETE-LINES>  will  work
with  the mark, not with the current parameter.  After the <PICK> or
<DELETE-LINES> is done the mark goes away.
                              - 21 -


     So if the nominal lines to pick is 1, and you type

        <MARK>
        <ENTER><PERCENT-GOTO>
        <PICK>

you will pick up all the text from where the mark is to the  end  of
the file.  If you do another <PICK> you will pick up one line.



6.5  SCANNING

     Scanning  is  where  SED  will  to  a  <ROLL-FORWARD-LINES>  or
<ROLL-BACKWARD-LINES>, wait a little, then roll again.  It will keep
rolling and waiting until you tell it to stop.

     To  start   scanning   type   <ENTER><ROLL-FORWARD-LINES>   (or
<-BACK->).  To stop type any character or RUBOUT.



6.6  CHANGING THE CASE OF CHARACTERS OR STRINGS

     The <CASE> command (KEYPAD-9) changes the case of  the  letters
starting  where  the  cursor  is.   Two  switches control way <CASE>
works:  /INVRT and /RAISE (use the <SWITCH> command, ^N, to  set  or
clear  switches).   If /INVRT is set (which is the default) then the
case of all the letters is inverted:  upper is changed to lower  and
lower to upper.

     If /NOINVRT is set then the setting  of  /RAISE  is  used.   If
/RAISE is set (default), lower case characters at the cursor will be
changed to upper case.  Upper case and non-alphabetic characters are
unaffected.  Likewise, if /NORAISE is set, upper case characters are
changed to lower case.

     The parameter to <CASE> is the number of characters to look  at
and  maybe  change the case of.  You can use cursor movement to make
<CASE> work for more than one line.  For example, suppose the cursor
is on the "b" and you type <ENTER><DOWN><CASE>:

BEFORE: Pack my box with five dozen liquor jugs.
        Pack my box with five dozen liquor jugs.

AFTER:  Pack my BOX WITH FIVE DOZEN LIQUOR JUGS.
        PACK MY box with five dozen liquor jugs.







                              - 22 -


6.7  SETTING OR CLEARING THE SPLIT-SCREEN WINDOW

     The <WINDOW>  command  (KEYPAD-1)  allows  you  to  divide  the
terminal screen into upper and lower halves and display (and edit) a
file in each half.  If windowing is in effect, typing <WINDOW> again
will bring the screen back to the normal single-file mode.

     After <WINDOW> is typed the file you are currently editing will
appear  in  the  top  half of the screen and the bottom half will be
blank.  If you do a <SET-FILE> (with or without  a  parameter),  the
top window will remain unchanged and the new file will appear in the
bottom window.  You can then use <SET-FILE>s to toggle  between  the
two windows or to change the file which appears in the window.



6.8  ERASING WORDS FROM THE FILE

     The <ERASE-WORD> command (KEYPAD-.) deletes the  TOPS-10  style
word which ends at the cursor position.

     <ERASE-WORD> also can be used to erase words in parameters.

     Typing <ENTER><HELP> will recover an erroneously erased word.



6.9  SUBSTITUTING (SEARCH AND REPLACE)

     The <SUBSTITUTE> command (^~) searches forward from the  cursor
position  for a string (the key) and substitutes another string (the
substitute string) for it.  You can tell <SUBSTITUTE> how many times
to repeat the process.

     There are three types of parameters to <SUBSTITUTE>:

  <ENTER>Sstring1  <ENTER>Rstring2  <ENTER>number

     The first sets up string1 as the search key.  The  string  must
be  preceded  by  the letter "S" (or "s").  The search key is shared
with the <SEARCH-FORWARD> and <SEARCH-BACKWARD> commands.

     The second parameter sets up string2 as the entity  to  replace
occurrences  of  string1.  The string must be preceded by the letter
"R" (or "r").  String2 may be null, meaning  that  string1  will  be
deleted wherever it is found.

     The third parameter tells how many times to perform the  search
and substitute.

     Searching is done the same as for  the  <SEARCH>  commands,  so
wild  characters,  case  independence, and aborting the command with
RUBOUT all work.

                              - 23 -


     One, two, or all three of these  parameters  may  be  given  at
once, in any order.  The command

        <ENTER>SFOO<ENTER>Rfoo<ENTER>1000<SUBSTITUTE>

will change all occurrences of "FOO" to "foo" from the cursor to the
end  of  the  file  (well, 1000 times, anyway).  Following the above
command with

        <ENTER>SFUBAR<ENTER>1000<SUBSTITUTE>

will change all occurrences of "FUBAR"  to  "foo".   Note  that  the
substitute key was not given, so it defaulted to its latest setting.

     Sometimes it is useful to set up the  parameters,  think  about
them,  and  perform  the substitute when everything looks right.  If
the numeric parameter is omitted, them <SUBSTITUTE> will set up  the
key and substitute string, but will not execute.  Thus the commands

        <ENTER>SGIG<ENTER>RTHING<SUBSTITUTE>
        <ENTER>1<SUBSTITUTE>
        <SUBSTITUTE>
        <ENTER>10<ENTER>STHIS<SUBSTITUTE>
        <SUBSTITUTE>

works as follows:

1) Only sets up the parameters.
2) Does one <SUBSTITUTE> since there was a numeric parameter.
3) Also does one <SUBSTITUTE>.
4) Changes the search key to "THIS" and does 10 iterations.
5) Also does 10 iterations.






















                              - 24 -


7.0  USEFUL COMMANDS FOR SPECIAL CASES

     This last section describes commands which are  not  used  very
much,  but  which  come in handy when they are needed.  For example,
files will usually be less than 80 characters wide, but if  you  are
editing  a  lineprinter  file you will want to know how to reach the
part of it that is off the right  of  the  viewing  window.   Topics
covered here are:

        WHAT TO DO IF THE FILE IS WIDE
        HOW TO PUT CONTROL CHARACTERS IN THE FILE
        MANY WAYS TO SAVE THE FILE
        REPAIRING A FRAGGED SCREEN
        JUSTIFYING TEXT
        REPEATING COMMANDS OR INVENTING YOUR OWN
        SETTING UP DEFAULT SWITCHES IN SWITCH.INI OR SED.INI



7.1  WHAT TO DO IF THE FILE IS WIDE

     The <SLIDE-LEFT> (KEYPAD-- [ESC-L]) and <SLIDE-RIGHT> (KEYPAD-,
[ESC-T]) commands move the viewing window left and right.  Note that
you are sliding the window over the file, so <SLIDE-RIGHT> shows you
higher-numbered columns.

     The parameter to the <SLIDE> commands is the number of  columns
to slide.



7.2  HOW TO PUT CONTROL CHARACTERS IN THE FILE

     Type <ENTER-CONTROL-CHARACTER> (^O) and the  actual  character.
To  insert a CONTROL-L in the file, type <ENTER-C-C> followed by the
character L.  This command can be used within a parameter, too.

     Useful control characters to insert  are  tab  (CONTROL-I)  and
formfeed or page mark (CONTROL-L).

     The <REAL-TAB> command (KEYPAD-0) can also be used to put a tab
in  the file.  It acts exactly as if you typed "<ENTER-C-C>I".  Note
that the <REAL-TAB> command  puts  a  tab  character  in  the  file,
whereas  the  <TAB>  command  causes the cursor to move but does not
actually modify the file.



7.3  MANY WAYS TO SAVE THE FILE

     The file you are editing is  saved  when  you  type  <EXIT>  or
<SET-FILE> (and not saved when you exit using <ABORT>).  You can set
the /SAVE:   and  /ISAVE:   switches  so  that  the  file  is  saved
automatically  every so many commands or characters of type-in.  See
the section about the <SWITCH> command (or, better yet,  Appendix  D
                              - 25 -


in  the  reference  manual,  DOC:SED.DOC).   There's also a command,
<SAVE-FILE> (PF4 [^_]) which saves the file when you type it.

     BEWARE:  <SAVE-FILE><ABORT> can leave nulls in the file  so  if
you've  changed  a  file  be  sure  to  end the editing session with
<EXIT>.



7.4  REPAIRING A FRAGGED SCREEN

     If your terminal screen has been messed up by a system  message
or  something  (or any time you're not confident that the display is
correct) you  can  force  the  screen  to  be  rewritten  by  typing
<REWRITE> (KEYPAD-5).  <ENTER>^<RESET> (that's the up-arrow or caret
character) also rewrites the screen.  The <RESET> command is  RUBOUT
or DELETE.



7.5  JUSTIFYING TEXT

     The <JUSTIFY> command (ESC-J) justifies or centers text  within
the  left  and  right margins.  The number of spaces to indent a new
paragraph may also be  given  (positive,  negative,  or  zero;   the
default  is  zero), as well as a string to be removed from the start
of each raw line and added to each justified line.  The text can  be
made flush against the right margin ("filled") or ragged.

     <JUSTIFY> works from the start or the line the cursor is on for
the  number  of lines given explicitly of using cursor movement.  If
<ENTER><JUSTIFY> is typed the range of the command is from the  line
where the cursor is to the end of the paragraph.

     The end of a paragraph is signaled by a blank line  or  a  line
which  begins  with  spaces  or  tabs.  The line the cursor is on is
always the start of a paragraph;  the last  line  of  the  range  is
always the end of a paragraph.

     A new paragraph in the justified test begins with a blank  line
and the indentation given by /PIND:.

     To center the line the cursor is  on,  type  <ENTER>C<JUSTIFY>.
The line will be centered between the left and right margins.

Switches used by <JUSTIFY>:

    /JPRE:s     delete string s from each input line;
                begin each output line with string s.
    /LMAR:n     set the left margin to be column n.
    /RMAR:n     set the right margin to be column n.
    /PIND:n     set the paragraph indentation to be n columns.
    /FILL       make a straight right margin (/NOFILL == ragged).

                              - 26 -


7.6  REPEATING COMMANDS OR INVENTING YOUR OWN

     If you have a sequence of commands which  you  want  to  repeat
many  times  (like  doing  a  search and substitute, for example, or
removing the first 16 characters of every line of the file) you  can
store that sequence in a buffer in the editor and then execute it as
many times as you like.

     You can also use these buffers to define  new  editor  commands
and attach them to terminal keys.  The buffers can be saved and read
from disk or set up in SWITCH.INI or SED.INI.

     The command which does these things is <EXECUTE>  (^X).   There
are  too  many details to describe here.  Suffice it to say that SED
has  a  language  which  includes  all  the  commands  plus  several
constructs  such  as DO WHILE and IF CHARACTER or POSITION, and that
you can write and run "programs" in that  language.   The  reference
manual, DOC:SED.DOC, contains all the details.



7.7  SETTING UP DEFAULT SWITCHES IN SWITCH.INI OR SED.INI

     The file SWITCH.INI can contain starting switch settings for  a
number of programs.  If you include in SWITCH.INI a line like

        SED/NBA/T:W

then SED will set those switches when it begins  to  run.   In  this
example  the  "no backup file" and "word-wise tabs" switches will be
set.

     SWITCH.INI can also be used to set  up  execute  buffers.   For
example,

        /X:NAME,^[X:$gig^PT^RT

sets up a buffer named "NAME" which does  a  <PUT>  and  a  carriage
return,  and  causes  it to be invoked when you type ESCAPE-X.  That
won't make much sense unless you've read up on the <EXECUTE> command
in  the  reference  manual (DOC:SED.DOC), but hopefully it will make
you curious.

     SED.INI works the same as SWITCH.INI except  that  SED  is  the
only  program  that reads it.  Lines in SED.INI do not have to begin
with "SED".








                              - 27 -


                              EXAMPLE I
                    VT52 TERMINAL KEYBOARD LAYOUT

     The VT52 has a numeric  keypad  to  the  right  of  the  normal
keyboard.  Four cursor movement keys are at the right of that keypad
and there are three colored buttons above  the  pad.   The  leftmost
(blue)  button  is the <ENTER> command, the rightmost one (BLACK) is
<HOME>, and the center one (RED) is <RECALL>.  The  number  keys  in
the  pad  invoke  SED commands.  Do not use the red ESC (SEL) key at
the upper left of the keyboard.


VT52 EDITOR KEYBOARD

.____.____.____.____.____.____.____.____.____.____.____.____.____.____.
!    !    !    !    !    !    !    !    !    !    !    !    !    !ERAS!
! !  ! @  ! #  ! $  ! %  ! ^  ! &  ! *  ! (  ! )  ! _  ! +  !SUBS!CHAR!
! 1  ! 2  ! 3  ! 4  ! 5  ! 6  ! 7  ! 8  ! 9  ! 0  ! -  ! =  ! ~` !back!
!____!____!____!____!____!____!____!____!____!____!____!____!____!____!_.
  !xon !ROLL!SRCH!SRCH!ROLL!ROLL!BACK!    !ENTR!PERC!    !    !ERAS!RE- !
  !    !BK L!BACK!FWD !FW L!FW P!TAB !TAB !CCH !GOTO! ]  ! |  !LINE!SET !
  ! q  ! w  ! e  ! r  ! t  ! y  ! u  ! i  ! o  ! p  ! [  ! \  !lnfd! del!
  !____!____!____!____!____!____!____!____!____!____!____!____!____!____!_.
    !ROLL!xoff!INS !DEL !    !CUR !ERAS!INS !DEL !    !    !    !         !
    !BK P!    !LINE!LINE!PUT !LEFT!LINE!SPAC!SPAC! :  ! "  ! }  ! RETURN  !
    ! a  ! s  ! d  ! f  ! g  ! h  ! j  ! k  ! l  ! ;  ! ,  ! {  !         !
.___!____!____!____!____!____!____!____!____!____!____!____!____!_________!
!     !    !    !    !    !SET !    !RE- !    !    !MRKR!       !    !    !
!shift!EXIT!EXCT!ABRT!PICK!FILE!SWCH!TURN! <  ! >  ! ?  ! shift !rept!copy!
!     ! z  ! x  ! c  ! v  ! b  ! n  ! m  ! ,  ! .  ! /  !       !    !    !
!_____!____!____!____!____!____!____!____!____!____!____!_______!____!____!

        NUMERIC PAD AT RIGHT     .____.____.____.____.
        OF NORMAL KEYBOARD:      !    !RE- !    !CUR !
                                 !ENTR!CALL!HOME! UP !
                                 !blue!red !blck! /\ !
                                 !____!____!____!____!
                                 !    !UP- !    !CUR !
                                 !MARK!TAB !CASE!DOWN!
                                 !  7 ! 8  ! 9  ! \/ !
                                 !____!____!____!____!
                                 !BEG-!RE- !END-!CUR !
                                 !LINE!WRIT!LINE!RGHT!
                                 ! 4  ! 5  ! 6  ! -> !
                                 !____!____!____!____!
                                 !WIN-!DOWN!    !CUR !
                                 !DOW !TAB !HELP!LEFT!
In addition:                     ! 1  ! 2  ! 3  ! <- !
                                 !____!____!____!____!
  ESCAPE-L is <SLIDE-LEFT>       !   REAL  !ERAS!INS !
  ESCAPE-T is <SLIDE-RIGHT>      !   TAB   !WORD!MODE!
  ESCAPE-S is <TAB-SET>          !    0    ! .  !entr!
  ESCAPE-J is <JUSTIFY>          !_________!____!____!

                              - 28 -


                             EXAMPLE II
                   VT100 TERMINAL KEYBOARD LAYOUT


VT100 KEYBOARD LAYOUT

._____.                                               .____.____.____.____.
!set- !                                               !    !    !    !    !
! up  !                                               ! /\ ! \/ ! <- ! -> !
!     !                                               ! UP !DOWN!LEFT!RGHT!
!___._!__.____.____.____.____.____.____.____.____.____!____!____!____!____!
!   !    !    !    !    !    !    !    !    !    !    !    !    !    !ERAS!
!esc! !  ! @  ! #  ! $  ! %  ! ^  ! &  ! *  ! (  ! )  ! _  ! +  !SUBS!CHAR!
!   ! 1  ! 2  ! 3  ! 4  ! 5  ! 6  ! 7  ! 8  ! 9  ! 0  ! -  ! =  ! ~` !back!
!___!____!____!____!____!____!____!____!____!____!____!____!____!____!____!_.
!     !xon !ROLL!SRCH!SRCH!ROLL!ROLL!BACK!    !ENTR!PERC!    !JUST!    !RE- !
! TAB !    !BK L!BACK!FWRD!FW L!FW P! TAB!TAB !CCH !GOTO! {  ! }  !    !SET !
!     ! q  ! w  ! e  ! r  ! t  ! y  ! u  ! i  ! o  ! p  ! [  ! ]  !    ! del!
!_____!____!____!____!____!____!____!____!____!____!____!____!____!    !____!
!       !ROLL!xoff!INS !DEL !    !CUR !ERAS!INS !DEL !    !    !       !    !
! caps  !FW P!    !LINE!LINE!PUT !LEFT!LINE!SPAC!SPAC! :  ! "  ! RETURN! |  !
! lock  ! a  ! s  ! d  ! f  ! g  ! h  ! j  ! k  ! l  ! ;  ! ,  !       ! \  !
!___.___!____!____!____!____!____!____!____!____!____!____!____!_______!____!
!         !    !    !    !    !SET-!    !RE- !    !    !MRKR!         !ERAS!
! shift   !EXIT!EXCT!ABRT!PICK!FILE!SWCH!TURN! <  ! >  ! ?  !  shift  !LINE!
!         ! z  ! x  ! c  ! v  ! b  ! n  ! m  ! ,  ! .  ! /  !         ! lf !
!_________!____!____!____!____!____!____!____!____!____!____!_________!____!

        NUMERIC PAD AT RIGHT     .____.____.____.____.
        OF NORMAL KEYBOARD:      !    !RE- !    !SAVE!
                                 !ENTR!CALL!HOME!FILE!
                                 ! pf1! pf2! pf3! pf4!
                                 !____!____!____!____!
                                 !    !UP- !    !SLID!
                                 !MARK!TAB !CASE!LEFT!
                                 ! 7  ! 8  ! 9  ! -  !
                                 !____!____!____!____!
                                 !BEG-!RE- !END-!SLID!
                                 !LINE!WRIT!LINE!RGHT!
                                 ! 4  ! 5  ! 6  ! ,  !
                                 !____!____!____!____!
                                 !WIN-!DOWN!    !INS !
                                 !DOW !TAB !HELP!MODE!
                                 ! 1  ! 2  ! 3  ! e  !
                                 !____!____!____! n  !
                                 !         !ERAS! t  !
                                 !REAL-TAB !WORD! e  !
                                 !    0    ! .  ! r  !
                                 !_________!____!____!

In addition: ESCAPE-S is <TAB-SET>
             ESCAPE-J is <JUSTIFY>


                              - 29 -