Google
 

Trailing-Edge - PDP-10 Archives - integ_tools_tops20_v7_30-apr-86_dumper - tools/sed2/sed.man
There are 20 other files named sed.man in the archive. Click here to see a list.



                                 SED

                            SCREEN EDITOR

                               TUTORIAL

                      (VAX/VMS Operating System)










                  Written by (DEC-10/DEC-20 version)
                          A Christopher Hall


                        Adapted for VAX/VMS by
                             Stan Peters























                 First VAX Edition:  October 18, 1982

                    Last Update:  January 19, 1983
SED Tutorial                                                   Page ii
Contents                                                     19 Jan 83


                               CONTENTS


CHAPTER 1       GETTING ACQUAINTED WITH SED

        1.1     The Viewing Window Concept . . . . . . . . . . . . 1-1
        1.2     The Cursor - Where It's At . . . . . . . . . . . . 1-1
        1.3     How to Talk to the Editor  . . . . . . . . . . . . 1-2


CHAPTER 2       HOW TO START WRITING A FILE

        2.1     Running the Editor . . . . . . . . . . . . . . . . 2-1
        2.2     Exiting the Editor . . . . . . . . . . . . . . . . 2-1
        2.3     Moving the Cursor Around . . . . . . . . . . . . . 2-2
        2.4     Putting Text in the File . . . . . . . . . . . . . 2-2
        2.5     Inserting and Deleting Characters  . . . . . . . . 2-3
        2.6     Moving the Screen Forward and Backward in the File 2-3


CHAPTER 3       EDITING AN EXISTING FILE, PART 1

        3.1     Introduction to Commands and Parameters  . . . . . 3-1
        3.2     On-line Help . . . . . . . . . . . . . . . . . . . 3-2
        3.3     Getting Back into Last Time's File . . . . . . . . 3-2
        3.4     Rolling the Screen a Long Distance . . . . . . . . 3-3
        3.5     Moving to the Beginning and End of the File  . . . 3-3
        3.6     Inserting and Deleting Lines and Spaces  . . . . . 3-3
        3.7     Copying or Moving Lines of Text  . . . . . . . . . 3-4


CHAPTER 4       EDITING AN EXISTING FILE, PART 2

        4.1     Compiling After Exiting  . . . . . . . . . . . . . 4-1
        4.2     Searches . . . . . . . . . . . . . . . . . . . . . 4-1
        4.3     Word-wise Tab and Backtab  . . . . . . . . . . . . 4-2
        4.4     Inserting Text in the File Using <PUT> . . . . . . 4-2
        4.5     Changing Files While Editing . . . . . . . . . . . 4-3
        4.6     Recovering Deleted Stuff . . . . . . . . . . . . . 4-4


CHAPTER 5       EDITOR GOODIES

        5.1     Defining Parameters by Moving the Cursor . . . . . 5-1
        5.2     Moving a Given Percent of the Way Through the File 5-2
        5.3     <SWITCH>: Setting Qualifiers or Querying Status  . 5-2
        5.4     <ERASE-LINE>: Erase from Cursor to End of Line . . 5-4
        5.5     How to Edit Parameters . . . . . . . . . . . . . . 5-4


CHAPTER 6       MORE EDITOR GOODIES

        6.1     Rectangular Insert/Delete Spaces . . . . . . . . . 6-1
        6.2     Token Parameters . . . . . . . . . . . . . . . . . 6-2
SED Tutorial                                                  Page iii
Contents                                                     19 Jan 83


        6.3     Picking or Deleting a Lot of Stuff . . . . . . . . 6-2
        6.4     Scanning . . . . . . . . . . . . . . . . . . . . . 6-3
        6.5     Changing the Case of Characters  . . . . . . . . . 6-3
        6.6     Setting or Clearing the Split-Screen Window  . . . 6-3
        6.7     Erasing Words from the File  . . . . . . . . . . . 6-4
        6.8     Substituting (Search and Replace)  . . . . . . . . 6-4


CHAPTER 7       USEFUL COMMANDS FOR SPECIAL CASES

        7.1     What to Do If the File is Wide . . . . . . . . . . 7-1
        7.2     How to Put Control Characters in the File  . . . . 7-1
        7.3     Many Ways to Save the File . . . . . . . . . . . . 7-2
        7.4     Repairing a Fragged Screen . . . . . . . . . . . . 7-2
        7.5     Repeating Commands or Inventing Your Own . . . . . 7-2
        7.6     Setting Up Default Qualifiers in SED.INI . . . . . 7-3
        7.7     Spawning a Subprocess from SED . . . . . . . . . . 7-3


APPENDIX A      KEYBOARD LAYOUT

        A.1     DEC VT100 Terminal . . . . . . . . . . . . . . . . A-1
        A.2     Visual 200 Terminal  . . . . . . . . . . . . . . . A-3











                              CHAPTER 1

                     GETTING ACQUAINTED WITH SED



This paper 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, SYS$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.
GETTING ACQUAINTED WITH SED                                   Page 1-2
How to Talk to the Editor                                    19 Jan 83


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.

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 or top of  the  normal
keyboard.   Not  all  terminals have them, and how many and where they
are vary from terminal to  terminal.   (See  Appendix  A.)  The  VT100
terminal, for example, has eight special keys.  Four of them, labelled
with directional arrows, are at the top right of  the  main  keyboard.
Four  more,  labelled PF1 through PF4, are on the numeric keypad.  The
other keys on the numeric keypad can also double as special keys.

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 (Appendix A) 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.

See Appendix A for "maps" of the layout  of  SED's  commands  on  some
common terminals.  There is also a series of keyboard maps for all the
terminals  SED  supports  on  SYS$DOC.   They  are  in   files   named
SYS$DOC:SEDxxxxxx.KYS,  where  xxxxxx  is  the  name  of the terminal:
VT100, VIS200, CIT101, etc.











                              CHAPTER 2

                     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 the DCL command:

        $ SED filename.typ       or
        $ SED filename.typ=

Either form will find the given file (in this case,  filename.typ)  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, qualifiers (switches) can be included along with the  filespecs.
The  qualifiers  are described under the <SWITCH> command, which comes
later.  In any case, the syntax is

        $ SED filename.typ/qualifier/qualifier...



2.2  Exiting the Editor

Exit SED by typing <EXIT> (^Z) to save your editing session or <ABORT>
(^C) to forget it.
HOW TO START WRITING A FILE                                   Page 2-2
Exiting the Editor                                           19 Jan 83


<EXIT> will save all the changes you have made in your  file.   A  new
version  (with  all  the  new  changes) of the file you are editing is
created.  This file will have a version number  one  higher  than  the
original  file.  The original (which is now the old, or "backup") file
is not changed or deleted.

<ABORT> exits the editor and leaves the file the  way  it  was  before
editing began.  A new version is not created.



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  screen  and  in  the
file.

The cursor can be moved up, down, left, and right by typing one of the
cursor  moving  commands:   <CURSOR-UP>, <CURSOR-DOWN>, <CURSOR-LEFT>,
and <CURSOR-RIGHT>.  Usually these commands are on special  keys  with
an  arrow on them.  The direction of the arrow indicates the direction
which the cursor will move.  There is also a <CURSOR-HOME> command  to
move  the  cursor  "home",  which  means  the upper left corner of the
screen;  type PF4.

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

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

Some implementations of SED may use the <LINE>  command  (^DELETE)  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.
HOW TO START WRITING A FILE                                   Page 2-3
Putting Text in the File                                     19 Jan 83


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> (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.

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>  (DELETE).  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).











                              CHAPTER 3

                   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  key  for  <ENTER-PARAMETER>
(PF1).   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,
EDITING AN EXISTING FILE, PART 1                              Page 3-2
Introduction to Commands and Parameters                      19 Jan 83


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> (^]) will delete the entire parameter.  To  kill  the
entire  parameter  and get out of ENTER mode, type the <RESET> command
(PF3).

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

        <ENTER>4<ROLL-FORWARD-LINES>

That is, PF1 4 ^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>  (KP-3), or <ENTER> twice, then the command you want help with.
Try it.



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

        $ 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.
EDITING AN EXISTING FILE, PART 1                              Page 3-3
Rolling the Screen a Long Distance                           19 Jan 83


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 ^Q).  A page is
defined as one screen-full of lines (about 24).

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

        <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 ^A.  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> (^S) deletes characters (not just  spaces)  where  the
cursor is.  It shares its parameter with <INSERT-SPACES>.
EDITING AN EXISTING FILE, PART 1                              Page 3-4
Inserting and Deleting Lines and Spaces                      19 Jan 83


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

        <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
EDITING AN EXISTING FILE, PART 1                              Page 3-5
Copying or Moving Lines of Text                              19 Jan 83


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>.

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.











                              CHAPTER 4

                   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
        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  (DELETE  on  some
terminals).

You can set up the  current  search  key  as  a  parameter  by  typing
<ENTER>S<RECALL> (<RECALL> is PF2).  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
EDITING AN EXISTING FILE, PART 2                              Page 4-2
Searches                                                     19 Jan 83


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  Word-wise Tab and Backtab

Tab stops are set every 8 positions, and the <TAB>  (TAB  or  ^I)  and
<BACKTAB>   (^U)   commands   move  to  the  next  or  previous  stop,
respectively.  However, <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>NOT<SWITCH>

where "NOT" is the three letters N,  O,  T  ;   and  <SWITCH>  is  ^N.
<SWITCH> is a command which sets editor switches (qualifiers), and you
are telling it that you do not want normal tabs (NO  Tabs,  get  it?).
You can get normal tabs back by typing <ENTER>T<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.
EDITING AN EXISTING FILE, PART 2                              Page 4-3
Changing Files While Editing                                 19 Jan 83


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 a filetype in your filespec, SED will  try  several
as defaults.  First it will try to find the file with no extension.

Next SED will try the filetype 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:  MAR,
DAT, FOR, COM, PAS, PLI, RNO.  If all of these fail you will (finally)
get the "File not found" error message.

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

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

        <ENTER>FOO.BAR/OUT=FUBAR.MAR<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.MAR.  Also, the name of the current file  can  be  changed,  for
example, by:

        <ENTER>OUT=THING.GIG<SWITCH>

This will change the name of the current file to THING.GIG.

There are also other qualifiers which apply to <SET-FILE>,  and  other
useful  features.   See  the  <SET-FILE>  and <SWITCH> sections of the
reference manual, SYS$DOC:SED.DOC, for details.
EDITING AN EXISTING FILE, PART 2                              Page 4-4
Recovering Deleted Stuff                                     19 Jan 83


4.6  Recovering Deleted Stuff

The commands <DELETE-LINES> (^F), <DELETE-SPACES>  (^S),  <ERASE-LINE>
(^]), <ERASE-WORD> (KP-.), and <DELETE-CHARACTER> (DELETE) 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>.











                              CHAPTER 5

                            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 QUALIFIERS 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:
EDITOR GOODIES                                                Page 5-2
Defining Parameters by Moving the Cursor                     19 Jan 83


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 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>

The quickest way to get back to the start of the file is to type

        <PERCENT-GOTO>



5.3  <SWITCH>:  Setting Qualifiers or Querying Status

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

Qualifiers can also be given when running SED, or in SED.INI.
EDITOR GOODIES                                                Page 5-3
<SWITCH>: Setting Qualifiers or Querying Status              19 Jan 83


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: [HALLC]SED.RNO  LINE: 534(67%) POS'N: 1 ALT: [HALLC]FOO.BAR

This line says that the current file is SED.RNO, 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, TB:8; KEY:th SUB:FOO

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
        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 qualifiers which you can set to  tailor  SED  to
your  own  tastes.   Here  are  the  most useful ones.  See the editor
reference manual,  SYS$DOC:SED.DOC,  for  a  description  of  all  the
qualifiers.

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")
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)
RESET   reset command nominals after each command
ISAVE=n do an incremental save every n commands
SAVE=n  do an incremental save every n characters of type-in
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/NOCASE/GOTO=0/RESET/NOISAVE/NOSAVE/TABS=8.
LENGTH  and  WIDTH are the dimensions of your terminal (usually 24 and
80).
EDITOR GOODIES                                                Page 5-4
<SWITCH>: Setting Qualifiers or Querying Status              19 Jan 83


Typing NOqualifier 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  the
same as GOTO.

Ideas:  /NOTABS is more fun than /TABS.  If you don't like the clutter
of  multiple  versions,  set  /NOBACK in SED.INI.  Then set /BACK only
when you are editing a file and you  want  to  preserve  the  unedited
copy.   To  look at a file and ensure it won't be changed use /READ in
the <SET-FILE> or DCL level SED command.



5.4  <ERASE-LINE>:  Erase from Cursor to End of Line

The <ERASE-LINE> command (^]) 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>         ^H
                       <DELETE-CHARACTER>    DELETE
    latest word        <BACKTAB>             ^U
    entire parameter   <ERASE-LINE>          ^]

Also, to forget the parameter entirely type <RESET> (PF3).

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, if necessary, by typing RUBOUT (DELETE on some
terminals).  Then type the <RECALL> command (PF2), 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".
EDITOR GOODIES                                                Page 5-5
How to Edit Parameters                                       19 Jan 83


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.











                              CHAPTER 6

                         MORE EDITOR GOODIES



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

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



6.1  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 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.
MORE EDITOR GOODIES                                           Page 6-2
Token Parameters                                             19 Jan 83


6.2  Token Parameters

Sometimes the parameter you  want  is  looking  up  at  you  from  the
terminal  screen.   Instead  of  having  to  type  it you can 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.3  Picking or Deleting a Lot of Stuff

Using the <MARK> (KP-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.

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.
MORE EDITOR GOODIES                                           Page 6-3
Scanning                                                     19 Jan 83


6.4  Scanning

Scanning  is   where   SED   will   do   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.5  Changing the Case of Characters

The <CASE> command (KP-9) changes the case  of  the  letters  starting
where the cursor is.  Two qualifiers control way <CASE> works:  /INVRT
and /RAISE (use the <SWITCH> command, ^N, to set or clear qualifiers).
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" of box in the first line 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.



6.6  Setting or Clearing the Split-Screen Window

The <WINDOW> command (KP-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.
MORE EDITOR GOODIES                                           Page 6-4
Erasing Words from the File                                  19 Jan 83


6.7  Erasing Words from the File

The <ERASE-WORD> command (KP-.) deletes the 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.8  Substituting (Search and Replace)

The <SUBSTITUTE> command (^SPACE) 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 parameter 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.

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 (starting at the current cursor  position)
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
MORE EDITOR GOODIES                                           Page 6-5
Substituting (Search and Replace)                            19 Jan 83


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.

Note:  <SUBSTITUTE> is the only command for  which  multiple  <ENTER>s
are  legal.  For other commands, all <ENTER>s except the first one are
ignored.











                              CHAPTER 7

                  USEFUL COMMANDS FOR SPECIAL CASES



This chapter 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
        REPEATING COMMANDS OR INVENTING YOUR OWN
        SETTING UP DEFAULT QUALIFIERS IN SED.INI
        SPAWNING A SUBPROCESS FROM SED



7.1  What to Do If the File is Wide

The <SLIDE-LEFT> (^~) and <SLIDE-RIGHT> (^\) 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 (KP-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
USEFUL COMMANDS FOR SPECIAL CASES                             Page 7-2
How to Put Control Characters in the File                    19 Jan 83


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= qualifiers 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 in the reference  manual,
SYS$DOC:SED.DOC).   There's  also  a command, <SAVE-FILE> (KP-,) which
saves the file when you type it.

BEWARE:  <SAVE-FILE><ABORT> leaves your file in a format readable only
by  SED.   So  if  you've  changed  a  file be sure to end the editing
session with <EXIT>.  (Or, let SED fix up the file the next  time  you
edit it.)



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>
(KP-5).  <ENTER>^<RESET> (that's the up-arrow or caret character) also
rewrites the screen.  The <RESET> command is PF3.



7.5  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 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,
SYS$DOC:SED.DOC, contains all the details.
USEFUL COMMANDS FOR SPECIAL CASES                             Page 7-3
Setting Up Default Qualifiers in SED.INI                     19 Jan 83


7.6  Setting Up Default Qualifiers in SED.INI

When SED starts up it tries to find its default command file, SED.INI,
in  your  current  directory  ([]).  If that fails, SED looks again in
your logged-in directory (SYS$LOGIN).  If SED.INI contains a line like

        /NBA/NT

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

SED.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 (SYS$DOC:SED.DOC), but hopefully it will make
you curious.



7.7  Spawning a Subprocess from SED

The <SPAWN> command (not implemented) creates a subprocess under  SED.
You can then issue any DCL commands you want.  Logging-out will logout
the subprocess and return you to the editing session as you left it.











                              APPENDIX A

                           KEYBOARD LAYOUT



SED commands are invoked by typing a control character or  pressing  a
function  key.  For terminals without function keys, some commands may
need to be typed as an "escape sequence." Therefore, what you type may
vary  somewhat from terminal to terminal.  However, the general layout
is:

     ._____.     ._____.     ._____.     ._____.     .___________.
     |ENTER|     |SUBST|     |LINE |     |ERASE|     |   SLIDE   |
     |PARAM|     |ITUTE|     |     |     |LINE |     |LEFT  RIGHT|
     |  [  | ... |  @  | ... |  _  | ... |  ]  | ... |  ^     \  |
     |_____|     |_____|     |_____|     |_____|     |_____|_____|
     .___________________________________________________________.
     | ROLL-BACK |  SEARCH   |ROLL-FORWRD|    TAB    |ENTER|PRCNT|
     |PAGES LINES|BKWRD FORWD|LINES PAGES|BKWRD FORWD|C-CH |GOTO |
     |  q     w  |  e     r  |  t     y  |  u     i  |  o  |  p  |
     |_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|
       |INSRT DELET|INSRT DELET|PUT  |        CURSOR         |
       |  SPACES   |   LINES   |     |LEFT  DOWN  UP    RIGHT|
       |  a     s  |  d     f  |  g  |  h     j     k     l  |
       |_____|_____|_____|_____|_____|_____|_____|_____|_____|
         |EXIT |EXE- |ABORT|PICK |SET  |SWTCH|RE-  |
         |     |CUTE |     |     |FILE |     |TURN |
         |  z  |  x  |  c  |  v  |  b  |  n  |  m  |
         |_____|_____|_____|_____|_____|_____|_____|


Notice  how  the  commands  are  grouped.   There   is   no   mnemonic
relationship (except by coincidence) between the name of a command and
the key it is on.  Instead, commands with similar functions are placed
near each other.  Most SED users agree that this system is better than
a mnemonic placement which would chaotically scatter the commands  all
over the keyboard.



A.1  DEC VT100 Terminal

The SED command layout on a DEC VT100 terminal appears (in two parts!)
on  the  next page.  No escape sequences are necessary, since SED uses
the   numeric   keypad   as   a   set   of   function   keys.     (See
SYS$DOC:SEDVT100.KYS for an "all in one piece" terminal map.)
KEYBOARD LAYOUT                                               Page A-2
DEC VT100 Terminal                                           19 Jan 83


    ._______.
    |       |
    |       |          DEC VT100 Keyboard for the SED Editor
    |set-up |
    |_______|_________________________________________________________
    |     |     |     |     |     |     |     |     |     |     |
    |     |  !  |  @  |  #  |  $  |  %  |  ^  |  &  |  *  |  (  |  )
    | esc |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  0
    |_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____
    |  TAB   | ROLL-BACK |  SEARCH   |ROLL-FORWRD|    TAB    |ENTER|
    |        |PAGES LINES|BKWRD FORWD|LINES PAGES|BKWRD FORWD|C-CH |
    |  tab   |  q  |  w  |  e  |  r  |  t  |  y  |  u  |  i  |  o  |
.___|________|_____|_____|_____|_____|_____|_____|_____|_____|_____|__
|     |        |INSRT DELET|INSRT DELET|PUT  |        CURSOR         |
|     | caps   |  SPACES   |   LINES   |     |LEFT  DOWN   UP   RIGHT|
|ctrl | lock   |  a  |  s  |  d  |  f  |  g  |  h  |  j  |  k  |  l  |
|_____|________|_____|_____|_____|_____|_____|_____|_____|_____|_____|
|     |           |EXIT |EXE- |ABORT|PICK |SET  |SWTCH|RE-  |     |
| no  |           |     |CUTE |     |     |FILE |     |TURN |  <  |  >
|scrol|   shift   |  z  |  x  |  c  |  v  |  b  |  n  |  m  |  ,  |  .
|_____|___________|_____|_____|_____|_____|_____|_____|_____|_____|___
                    |                      SUBSTITUTE
                    |                         space
                    |_________________________________________________

          ._______________________.          ._______________________.
          |        CURSOR         |          |ENTER RECAL RESET|CURSR|
          | UP   DOWN  LEFT  RIGHT|          |    PARAMETER    |HOME |
          | /\  | \/  | <-- | --> |          | pf1 | pf2 | pf3 | pf4 |
__________|_____|_____|_____|_____|_____.    |_____|_____|_____|_____|
    |     |     |     |SLIDE|CURSR|     |    |MARK | UP- |CASE | TAB |
 (  |  )  |  _  |  +  |LEFT |LEFT |     |    |     | TAB |     |SET/C|
 9  |  0  |  -  |  =  | ~ ` |bcksp|break|    |  7  |  8  |  9  |  -  |
____|_____|_____|_____|_____|_____|_____|    |_____|_____|_____|_____|
 |ENTER|PRCNT|     |ERASE|RE-  |ERASE|       |BEGIN| RE- | END |SAVE |
 |C-CH |GOTO |  {  |LINE |TURN |CHAR |       |LINE |WRITE|LINE |FILE |
 |  o  |  p  |  [  |  ]  |     |delet|       |  4  |  5  |  6  |  ,  |
_|_____|_____|_____|_____|     |_____|       |_____|_____|_____|_____|
         |     |     | RETURN  |SLIDE|       |WIN- |DOWN |HELP |INSRT|
    RIGHT|  :  |  "  |         |RIGHT|       |DOW  |TAB  |     |MODE |
   |  l  |  ;  |  '  | return  |  \  |       |  1  |  2  |  3  |     |
___|_____|_____|_____|_________|_____|       |_____|_____|_____|     |
|     |     |LINE |         |CURSR|          | REAL-TAB  |ERASE|     |
|  <  |  >  |  ?  |         |DOWN |          |           |WORD |     |
|  ,  |  .  |  /  |  shift  |linfd|          |     0     |  .  |enter|
|_____|_____|_____|_________|_____|          |___________|_____|_____|
              |
              |
______________|

Hold down the "ctrl" key  while  typing  commands  on  the  letter  (a
through z), space, or special character ("]", "/", "", "`") keys.  All
other commands are typed by pressing the indicated key.
KEYBOARD LAYOUT                                               Page A-3
Visual 200 Terminal                                          19 Jan 83


A.2  Visual 200 Terminal

Here is the layout for the Visual 200 terminal.  Since  this  terminal
has a lot of function keys, no "escape sequences" are necessary.

 .____________________________________________________________________
 |ENTER RECAL|INSRT|DELET|REAL |MARK |LINE |CASE |WIN- |HELP |BEGIN
 | PARAMETER |MODE |CHAR |TAB  |     |     |     |DOW  |     |    LINE
 | f0  | f1  | f2  | f3  | f4  | f5  | f6  | f7  | f8  | f9  | f10 |
 |_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|__
._____________________________________________________________________
|     |     |     |     |     |     |     |     |     |     |     |
|     |  !  |  "  |  #  |  $  |  %  |  &  |  '  |  (  |  )  |     |  =
| esc |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  0  |  -
|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|___
  |TAB  | ROLL-BACK |  SEARCH   |ROLL-FORWRD|    TAB    |ENTER|PRCNT|
  |     |PAGES LINES|BKWRD FORWD|LINES PAGES|BKWRD FORWD|C-CH |GOTO |
  | tab |  q  |  w  |  e  |  r  |  t  |  y  |  u  |  i  |  o  |  p  |
  |_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_
    |     |INSRT DELET|INSRT DELET|PUT  |        CURSOR         |
    |     |  SPACES   |   LINES   |     |LEFT  DOWN   UP   RIGHT|  +
    | ctrl|  a  |  s  |  d  |  f  |  g  |  h  |  j  |  k  |  l  |  ;
    |_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____
    |       |EXIT |EXE- |ABORT|PICK |SET  |SWTCH|RE-  |     |     |
    |       |     |CUTE |     |     |FILE |     |TURN |  <  |  >  |  ?
    | shift |  z  |  x  |  c  |  v  |  b  |  n  |  m  |  ,  |  .  |  /
    |_______|_____|_____|_____|_____|_____|_____|_____|_____|_____|___
          |     |                                                   |
          | caps|                                                   |
          | only|                       space                       |
          |_____|___________________________________________________|_
KEYBOARD LAYOUT                                               Page A-4
Visual 200 Terminal                                          19 Jan 83


                                                             ._____.
                                                             |CLEAR|
_____________________________________________________________|LINE |
 |WIN- |HELP |BEGIN  END |  UP  DOWN |            CURSOR           |
 |DOW  |     |    LINE   |    TAB    |LEFT  RIGHT   UP  DOWN  HOME |
 | f8  | f9  | f10 | f11 | f12 | f13 | <-- | --> |  /\ |  \/ | home|
_|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|_____|
__________________________________________.      ._________________.
|     |     |     |     |   SLIDE   |CURSR|      |  INSERT   |TAB  |
|  (  |  )  |     |  =  |LEFT  RIGHT|LEFT |      |LINE  SPACE|SET/C|
|  8  |  9  |  0  |  -  |  ^     \  |  bs |      |  7  |  8  |  9  |
|_____|_____|_____|_____|_____|_____|_____|___.  |_____|_____|_____|
 TAB    |ENTER|PRCNT|SUBST|     |LINE |RETURN |  |  DELETE   |     |
   FORWD|C-CH |GOTO |ITUTE|  {  | del |    r  |  |LINE  SPACE|     |
  |  i  |  o  |  p  |  @  |  [  |RESET|    e  |  |  4  |  5  |  6  |
__|_____|_____|_____|_____|_____|_____|_.  t  |  |_____|_____|_____|
 CURSOR         |     |     |ERASE|CURSR|  u  |  |   ERASE   |     |
      UP   RIGHT|  +  |  *  |LINE |DOWN |  r  |  |LINE  WORD |     |
 j  |  k  |  l  |  ;  |  :  |  ]  |  lf |  n  |  |  1  |  2  |  3  |
____|_____|_____|_____|_____|_____|_____|_____|  |_____|_____|_____|
|RE-  |     |     |     |         |     |        |     |SAVE |REWRT|
|TURN |  <  |  >  |  ?  |         |     |        |     |FILE |SCREN|
|  m  |  ,  |  .  |  /  |  shift  |scrol|        |  0  |  ,  |  .  |
|_____|_____|_____|_____|_________|_____|        |_____|_____|_____|
                    |         |                  |        |RETURN  |
                    | convert |                  |        |<ENTER> |
                    | function|                  |    -   |  enter |
____________________|_________|                  |________|________|


Use the "convert function" key to type CLEAR LINE or key- pad commands
(except  RETURN).   In  /KEYPAD  mode,  just  type  the keypad command
(convert function not needed).  /KEYPAD mode is  required  for  keypad
commands in <angle brackets>.