.ds F1 - % -
.ds Fd
.ds F3  ~
.ds Fl  Unit~IV
.ds Fr  Rand~Editor
.ds H1  ~
.ds Hl MP119
.ds Hr Introduction to UNIX
.fi
.PH "Editor Command" 5 2 2 3
.PP 5
Let's digress a moment to demonstrate how one can gain access to the
Rand Editor, before we discuss the different functions.  The command
used to access the editor is:
.sp
.ti 15
e [+] [name] [n] [nm]
.PP
Where "e" is short for the editor and "name" is the
name of the file to be edited.
.sp
Example:
.sp
.ti 25
e~~~junk
.sp
will cause the first 23 lines of the file "junk" to be displayed
in a "window" 78 columns wide as shown below:
.nf

	  _____________________________________________________
	  | Now is the time                                    |
	  | For all good men                                   |
	  | to come to the                                     |
	  | aid of their party                                 |
	  |                                                    |
	  |-                                                   |
	  |                                                    |
	  |                                                    |
	  |____________________________________________________|
						  junk line 6
.fi
Beneath the "window," the system will display the filename and the
current line number (line on which the cursor is positioned).
.PP
If "n" is specified following the name, such as:
.sp
.ti 25
e junk 50
.sp
the editor will be invoked and the file will be automatically advanced to
the 50th line. Therefore, line 50 will appear at the top of the
window.  This option allows you to scan the file beginning at line 50.
.PP
Let's take a look at the next option and see what happens.
For instance, suppose you entered the following command:
.sp
.ti 25
e junk 50 10
.sp
This causes the 10th character of each line to be displayed along
the left margin. That is, the 10th character will appear as the first
character of each line.  Line 50  will also be displayed at the top
of the window.
.PP
This feature can be quite benificial in comparing corresponding
characters or in trying to detect a particular sequence.
.PP
The last option, the "plus," is also of significance.  If the filename
is preceded by the "+," the previously edited file is established as
an alternate file, thereby giving you access to two files.  To
reference the alternate file, you would press the "USE" or <ctrl B> key.
Here is how that would be done.
.sp
.ti 25
e junk
.sp
.in 25
{edit junk
.sp
and leave the editor}
.sp
e +temp
.in -25
.sp
This would establish "temp" as the current file and "junk"
as the alternate file.  You can change from one file to the other
by pressing the "USE" or <ctrl B> key.
.sp
.in 10
.ti -10
Notes:(1) If the editor is called without specifying a filename,
the editor will use the most recently edited file.
.ti -10
~~~~~~(2) If the editor is called and there is no previously
edited file, follow these steps:
.br
.ti +5
a.~~Depress the "BREAK" key.
.br
.ti +5
b.~~Type an unused filename.
.br
.ti +5
c.~~Press "USE" or <ctrl B>.
.in -10
.sp 2
.in 6
.ti -6
Note: This same procedure can be used to reference an
alternate file anytime after the editor has been
invoked, allowing you to specify the alternate file.
.in -6
.PP
If the filename specified is a non-existent file, type "USE" or <ctrl B>
as soon as you have access to the editor.  This is the manner in
which files are created using the editor.
.PP
You are now ready to begin manipulating your file.  First let's
take a look at the various ways a file may be viewed or scanned.
.bp
.PH "Scanning a File"
.PP
The Rand Editor provides functions that allow a file to be
scanned from any direction: up, down, left or right.
.PP
Remember those two keys, SCROLL UP and SCROLL DOWN? Well, they
are also used in the editor to move the window up or down 10
lines.
.PP
The number of lines to scroll up or down can be controlled
by using the "BREAK" key in conjunction with the "SCROLL" keys.
Before continuing with an example, let's lay a little foundation.
.PP
First, all of the editor keys are functions.  This just means
that all the keys have been programmed to perform a specific
action: e.g., the "SCROLL" keys are programmed to move the
"window" up and down.
.PP
These functions are no different from any other function.
That is, values called arguments may be passed to them and used by
them to replace the established default values which will
normally be used.   Ten lines is the established default
for the "SCROLL" keys.
.PP
The "BREAK" key allows you to enter an argument which
replaces the default.  In some instances a number is required and
in other instances, characters are required depending upon the function.
.PP
Now let's get back to moving the "window"
.I "n"
lines, where "n" is some number other than 10. You will first
depress the "BREAK" key, then type the desired number, and
depress one of the "scroll" keys. For instance, to advance the
"window" 15 lines, type:
.sp
.ti 20
<break key>
.br
.ti 25
15
.br
.ti 20
<scroll up key>
.sp
.in 10
.ti -10
Notes:(1) When the "BREAK" key is depressed the editor displays
"ARG" below the "window."  What you type next will
appear adjacent to it.
.ti -10
~~~~~~(2) If the "BREAK" and "SCROLL UP" keys are used without
entering an argument, the text is moved up so that
the line with the cursor is the first line of the
"window."
.ti -10
~~~~~~(3) If the "BREAK" and "SCROLL DOWN" keys are used without
entering an argument, the text is moved down and the
line with the cursor is the last line of the "window."
.in -10
.sp
.PP
As mentioned earlier, the file may be moved either to
the left or to the right.  This is achieved by using the "PORT =>" <F2> and
the "PORT <=" <F1> function keys.
The "PORT =>" key <F2> moves the text in the "window" left 16 columns each time
it is depressed.
The "PORT <=" key moves the text in the "window" right 16 columns each time
it is depressed.
Suppose your file appears as:
.nf
	   ------------------------------------------|
	  |Now is the time now is the time           |
	  |For all good men,all good men             |
	  |To come to the aid, the aid               |
	  |Of their country, their country           |
	   -------------------------------------------

If you press "PORT =>" <F2>, the file will be displayed as:

	    ------------------------------------------
	   <now is the time                          |
	   <, all good men                           |
	   <id, the aid                              |
	   <, their country                          |
	   -------------------------------------------

.fi
.PP
The "<" indicates there is more text to the left of the line.
What would you do to restore the "window" back to its original state?
Answer in the space provided:
.sp 3
.PP
If your answer is  depress the "PORT <=" key <F1>, that's correct.  Since
"PORT =>" <F2> moved the "window" left, and "PORT <=" <F1> does exactly the opposite
of "PORT =>" <F2>,then it logically follows that the "PORT <=" key <F1>
would be used to move the "window" back towards the right.
.sp
.in 6
.ti -6
Note: The number of columns the "window" is moved either to the
right or to the left can be controlled also by taking
advantage of the "BREAK" key.   Suppose you wanted the
"window" shifted 5 positions to the  right, then you would
depress:
.sp
.ti +15
<break>
.br
.ti +18
5
.br
.ti +15
PORT <= <F1>
.in -6
.sp
.PH "Paging"
.PP
An entire "window" of text, referred to as a page, may be
moved either up or down by depressing the "NEXT PAGE" or the "PREVIOUS
PAGE" key, respectively.
.PP
Each time the "NEXT PAGE" key is depressed, the next 23
lines of text are moved up into the window.  Likewise, each time
the "PREVIOUS PAGE" is depressed, the previous 23 lines of text
are moved down into the window.
.PP
These features give you the capability to scan a file either
forward or backward.
.PP
You are probably thinking how tedious this would be if the
pages you want   to view are located in the middle of a large file.
As always, Unix provides features to make the life of the user
a little easier.  A file may be advanced or backed up any number
of pages by using the "BREAK" key and entering an argument before
depressing one of the above mentioned keys.
.sp
.PH "More on Scanning"
.PP
A function is also provided which allows you to specify
which line you want to view.  This line and surrounding lines will
be moved to the window. This feature is extremely beneficial in
modifying a file, especially if the corrections to be made are
scattered throughout the file. You gain access to this function
via the "GO TO" key <F7>, as follows:
.sp
.in 23
<break>
.br
50
.br
<GO TO> <F7>
.in -23
.sp
.PP
The sequence shown above will cause the editor to display line
50 with the cursor in the first position of the line. This feature can
also be used to scan a file either forward or backward. The line
specified doesn't have to be a subsequent line.
.bp
.PP
Hang on, the best is yet to come.  Suppose you have
just entered the editor, and  you want to reference a line near the
end of the file.  Which approach would you take?  Well, any of the
previously discussed methods can be used, but would pose quite
a task. However, this may be achieved with very little effort.  Just
type:
.ne 8
.sp
.in 23
<break>
.br
<GO TO> <F7>
.in -23
.sp
and the cursor will be positioned just past the last line of text
in the file.
.sp
.in 6
.ti -6
Note: The "GO TO" Key <F7> used without the "BREAK" key will
position the cursor at the beginning of the file.
.sp
.PH "Leaving the Editor"
.PP
After you have finished editing or creating your file, you
must then depress the "RUBOUT" key.  This takes control from the
editor and returns it to the command level.
.PP
Not only does the "RUBOUT" key take you out of the editor,
but it places a copy of the modified file in your directory. In
addition, a copy of the unmodified file remains  in your directory.
This is referred to as a backup file and is assigned the name
"filename.bak".
.PP
Unlike most systems, when the system crashes while a file is
being edited, the entire file isn't destroyed, only the modified version.
Or, if you aren't satisfied with the results of the modified
file, you can begin again by deleting the modified file and editing
the backup file.  The new backup file would then be "filename.bak.bak."
.PP
In the event of a system crash
the modified file can in most cases be salvaged, by issuing
the following sequence of commands:
.sp
.in 13
%cp /tmp/rettyx.login-name retty
.br
%editor -retty
.in -13
.sp
where "x" in the above commands refers to your terminal number
and, "login-name" is your login name. Here is an example of how
the first line appears.
.sp
.in 18
%cp /tmp/rettyn.mmw retty
.br
%editor -retty
.in -18
.sp
This causes the Editor to rerun your editing session; it will leave you at
the point where the system crashed.  I suggest that the next thing to do
is to save your file.
.ne 10
.sp
.in 10
.ti -10
Notes:(1) Backup files are manipulated the same as regular files
in all aspects
.br
.ti -10
~~~~~~(2) DO NOT use the Rand Editor before you have issued the
above sequence of commands.
.in -10
.ne 8
.sp 2
Let's check how you're doing.  Work the following exercise.
.sp
.PH "Exercise"
.sp
Using one of your existing files:
.L1 5 2 1
Gain access to the Rand Editor
.L1
Scan the file using the methods discussed.
.L1
Repeat beginning with #1, except use the backup file.
.E1
.PH "Modifying a file"
.PP
Notice the keys on the right of the keyboard.  These are used
to position the cursor, to insert text, and to delete text.
.PP
The manner in which characters are entered or changed in the Rand
Editor differs tremendously from the Text Editor, and should prove
to be quite an enjoyable experience.  There are no restrictions on
where the current input position is on the page. The cursor may be
moved up, down, right, or left. And, wherever the cursor is placed, that
becomes the current input position.
.PP
Characters or lines of characters may be modified by simply
moving the cursor and retyping.
.PP
There are 5 keys used for moving the cursor, the "HOME" key
and the "ARROWED" keys.  The "HOME" key positions the cursor under
the first character on the page; and the "ARROWED" keys are used to
move the cursor in the direction indicated on the key.
.sp
.in 6
.ti -6
Note: The "TAB" key is used to move the cursor 8 spaces
at a time from left to right. The "BACK TAB" key will do
just the opposite.
.in -6
.sp
.PH "Inserting Text"
.PP
Characters and blank lines may be inserted into the text by
using the "INS CHAR" and the "INS LINE" keys.
.PP
The "INS CHAR" key, when depressed, places the terminal in
the insert mode.  You will see a message to this effect displayed
below the "window."  While the terminal is in the insert mode,
everything you type will be inserted just before the cursor.
.PP
You needn't concern yourself about "over writing" any characters.
The system will make room for the inserted characters by shoving the
characters following the cursor over to the right.
.PP
Once you have entered the intended characters, depress the
"INS CHAR" key again.  This takes the terminal out of the insert mode.
.PP
Single characters, words, phrases, or complete
sentences may be inserted.
.sp
.ti 5
Example:  Suppose you inadvertently typed:
.sp
.ti 15
The Rand Editor is a tool to use.
.sp
.ti 5
instead of:
.sp
.ti +5
The Rand Editor is an extremely powerful tool to use.
.PP
And let's further assume that this sentence is embedded in a paragraph.
To correct without using the insert mode, you would have to retype
that line and the remainder of the paragraph.  Let's see how the
insert mode can be used to facilitate this.
.sp
.in 5
.in +8
.ti -8
Step 1: Position the cursor to the spot on the line where
the characters are to be inserted:
.in -8
.sp
.tr ~
.ti +8
The Rand Editor is an tool to use.
.br
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-
.sp
Step 2: Depress the "Ins Char" key.
.sp
Step 3: Now type the following:
.sp
.ti +12
extremely powerful
.sp
Step 4: Depress the "Ins Char" key.
.sp
The line will now appear as:
.sp
.ti +5
The Rand Editor is an extremely powerful tool to use.
.in -5
.ne 8
.PP
Lines of text or blank lines can also be inserted within a
file by using the "INS LINE" key.  Upon depression of the "INS LINE"
key, the editor will insert a blank line just before the line on which
the cursor is positioned.  You can then leave the line blank or type
some data on it.
.ne 10
.PP
Several blank lines may be inserted by successive depressions
of the "INS LINE" key, or by striking:
.sp
.in 20
<break key>
.br
<enter some number>
.br
<ins line key>
.in -20
.sp
.PH "Other Options"
.PP
The Rand Editor is  extremely flexible. It even
allows blanks or spaces to be inserted within a certain area of a
line or within a certain area of several lines.  This is achieved
by using the "BREAK" key, the "INS LINE" key, and moving the cursor.
How this is done can probably be best explained by an example. Assume
that you have the following typed in a file:
.sp
.ti 15
Procedure for running a program
.sp
.in 5
Step 1: Depress the start button on the console.
.br
Step 2: Depress the power button on the card reader.
.br
Step 3: Turn on the paper button on the printer.
.br
Step 4: Pull the master switch on the printer.
.in -10
.sp
.PP
You then decide that you want 10 spaces inserted following
the colon. Here's what you would do:
.sp
(Let's insert spaces in line 1 first)
.L1
Position the cursor
.sp
~~Step 1:  Depress the start button on the console.
.br
~~~~~~~~~~~-
.L1
Depress the "BREAK" key.
.L1
Move the cursor 10 positions as follows:
.sp
~~Step 1:  Depress the start button on the console
.br
~~~~~~~~~~~-------------
.sp
.in 10
.ti -10
~~~~Note: The Editor will display  "cursor defined"
as the argument for the "BREAK" key.
.in -10
.ne 8
.L1
Depress the "INS LINE" Key.
.E1
.sp
~~~~Line 1 of your file will now appear as:
.sp
~~~~Step 1: Depress the start button on the console.
.PP
Do the following to insert 10 spaces following the colon throughout the
procedure:
.L1
Follow steps 1 through 3 of the above example.
.L1
Move the cursor downward to the last line to be modified.
.sp
.in 10
Step 1:  Depress the start button on the console.
.br
~~~~~~~~~-----------
.br
Step 2:  Depress the power button on card reader.
.br
~~~~~~~~~~~~~~~~~~~-
.br
Step 3:  Turn on the paper button on the printer.
.br
~~~~~~~~~~~~~~~~~~~-
.br
Step 4:  Pull the master switch on the printer.
.br
~~~~~~~~~~~~~~~~~~~-
.L1
Depress the "INS LINE" key.
.E1
.sp 2
.in 6
.ti -6
Note: The "INS LINE" key can also be used to move characters
from one line to the next. Here is how that is done:
.sp
Given:  Step 4: Pull the master switch on the printer.
.sp
If the following steps are performed:
.sp
.L2 10
Position the cursor under the "P" of pull.
.sp
.L2
Depress the "BREAK" key
.sp
.L2
Depress the "INS LINE" key.
.E2
.in 6
.sp
the results will be:
.sp
.ti +6
Step 4:
.br
.ti +6
Pull the master switch on the printer.
.br
.bp
.in 0
It's time for another check of your progress. Do the following
exercises.
.PH "Exercises"
.sp
Use the Rand Editor to do the following:
.L1 5 2 1
Create the following file:
.sp
.in 10
Procedure for running a program
.br
Step 1: Depress the button on the console.
.br
Step 2: Depress the power button on card reader.
.br
Step 4: Pull the master switch on the printer.
.L1
Using the file in #1 insert 3 blank lines following the title.
.L1
In line 2, insert the word "start" just before button.
.L1
Insert the following line just before "Step 4."
.ti 10
Step 3: Turn on the paper button on the printer.
.L1
Modify the 2nd line such that it appears as:
.ti 10
Step 1: Depress the start button on the console.
.E1
.sp 2
If you had any problems, reread the "Other Options" section.
Otherwise, let's move on.
.bp
.PH "Removing Text"
.PP
Now that you've learned how to insert text, let's discuss how
to delete text.  UNIX further demonstrates its uniqueness in the
manner in which it allows you to remove text from a file.
Single characters, portions of a line/lines, or entire
line/lines of text may be removed from a file by back spacing with the
cursor and over-striking with the shift or by using the "DEL CHAR"
or "DEL LINE" keys.
or the "DEL LINE" key.
.PP
The "DEL CHAR" key deletes the character under which the cursor
is positioned when depressed.
.PP
Characters can also be deleted by the "BACKSPACE DELETE"
<cntrl carrot(^)>. Backspace delete is similar to the space
bar(shift) except that it moves the cursor to the left instead
of to the right. In normal mode, it moves the cursor left one
position, and inserts a blank in that position. In insert mode,
it moves the cursor left one position, deleting the character at that
position and moving all characters to ther right of the deleted
character one position to the left.
.PP
To delete portions of a line or entire lines, the "DEL LINE"
key is used.  Each time the "DEL LINE" key is depressed, the Editor
deletes the line containing the cursor.
.PP
To obviate the need to repeatedly press the "DEL LINE" key to
delete several lines, the "BREAK" key may be used.
.PP
Portions of a line may be deleted by adhering to the following
procedure:
.sp
.in 13
.ti -8
Step 1: Position the cursor under the first character
in the string of characters to be deleted.
.sp
.ti -8
Step 2: Depress the "BREAK" key.
.sp
.ti -8
Step 3: Move the cursor just past the last character
of the string to be deleted.
.sp
.ti -8
Step 4: Depress the "DEL LINE" key.
.in -13
.sp
Sounds familiar doesn't it?  You will notice that the same
basic steps were used to insert spaces within a line.
.PP
Now, let's determine how an area (the same number of
characters on several different lines) can be deleted.
.sp
.in 13
.ti -8
Step 1: Follow steps 1 thru 3 of the preceding
procedure.  The directions refer to line
1 of the area to be deleted.
.sp
.ti -8
Step 2: Move the cursor downward, remaining in the
same column, until you reach the last line
in the area to be deleted.
.sp
.ti -8
Step 3: Depress the "DEL LINE" key.
.in -13
.sp
.ne 10
.in 10
.ti -10
Notes:(1) To delete all characters from the cursor to the end of
a line, depress the "BREAK" key followed by the
"DEL LINE" key. This also has the effect of attaching the next
line to the current one.
.sp
.ti -10
~~~~~~(2) Blanks are characters.  Therefore, they may be deleted
also.
.sp
~~~~~~(3) You can insert multiple blank spaces on several lines
(i.e. white space) by using a procedure which closely resembles
the above described procedure for deletifg the same number of characters
on several different lines. The only difference is that instead of
hitting "DEL LINE" at the end hit "INS LINE".
.sp
~~~~~~(4) When you delete a line using the "DEL LINE" key
or several lines using the procedure described above the material
that is deleted is stored in the CLOSE or ALTERNATE buffer. The most recently
deleted material (i.e. the last close buffer entry) can be
recovered by typing <break> PUT (or <break> F4 on the Superbee).
This procedure will prove very useful when you accidently
delete a line.
.in -10
.PH "Exercise"
.PP
Use one of your "play" files to practice the procedures
discussed in this section.  (This should be easy, as the procedures
are so similar to those involved in inserting text.)
.PH "Searching a File"
.PP
This next feature is extremely useful in making
corrections to a file, such as correcting spelling errors or
modifying phrases.  It saves you from the boring, tedious operation
of scanning the file, and using one of the methods discussed earlier
to locate the item to be modified.
.PP
You can actually specify a word or a group of words and
direct the editor to locate them for you.  The functions used to
achieve this can be accessed through the "+SEARCH" <F5> and the "-SEARCH" <F6> function
keys.  The characters searched for are called a "search" key.
.PP
The "+SEARCH" <F5> function performs a forward search of the "search"
key beginning from the cursor and continuing forward through the file
until the first occurrence of the "search" key or the end of
the file is encountered.
.PP
The "-SEARCH" <F6> function performs a backward search of the search
key beginning from the cursor and continuing backward through the file
until the first occurrence of the "search" key or the beginning of
the file is encountered.
.PP
Suppose the cursor is positioned at the beginning of the
file, and you want to locate the word "procedure."  You would do
the following:
.sp
.in 18
Depress:~~<break key>
.sp
Type:~~~~~procedure
.sp
Press:~~~~+SEARCH <F5>
.in -18
.sp
.ne 10
.in 6
.ti -6
Note: The editor will display  "+Search: procedure."
After a short pause, the editor will either point out
the word "procedure" or it will display the message
"search key not found."  If the latter happens, check
the "search" key to ascertain that it was correctly
entered.  If so, then the search key does not exist
in the file.
.in -6
.PP
Okay, suppose the search is successful, that is, the
editor locates the "search" key.  However, it isn't the one you
wanted. You wanted the next occurrence of the "search" key.
What do you do?  Well, you simply depress the  +SEARCH
<F5> key again.  This causes the editor to begin another search
for the same "search" key beginning from its present position.
Consequently, you can locate any occurrence of a "search" key
by repeatedly depressing the "+SEARCH" key <5> until you locate the one you
want.
.PP
Now, suppose that you aren't at the beginning of the
file and you initiate a forward search.  The editor responds
with "search key not found."  Yet, you are certain that the
search key does exist in the file.  Well, before you decide
"this thing is crazy!", consider this alternative -- that the
cursor is positioned past the search key that you are trying to locate.
How would you locate the search key in question?  Answer in the space
provided.
.sp 2
That's exactly correct, you would initiate a backward search by
using the "-SEARCH" <F6> key.
.PH "Implied Keys"
.PP
Implied search keys are formed by using the "BREAK" key
followed by either the "+SEARCH" <F5> or the "-SEARCH" <F6> key.  You are probably
wondering how this is different.  The difference is, you do not
enter an argument to be used as the search key.  The argument is
formed by using the character under which the cursor is positioned
as the first character of the search key, and the character just
before the next space as the last character of the search key.
.PP
Just how can this feature be applied?  It can be used as
a shorthand method of entering a search key.  How?  Well,
you could be just scanning the file when you notice
a certain word.  You become curious as to whether or not it appears
somewhere else in the file.  To determine whether it does,  you
merely position the cursor under the first letter of the word, and
depress the "BREAK" and "+SEARCH" <F5> keys.
.bp
.sp 2
Let's check ourselves one more time.  Do the following exercises.
.PH "Exercises"
.sp
Use the following file for the exercises below:
.sp
.in 10
Now is the time, Now is the time
.br
For all good men, All good men
.br
to come to the aid, the aid
.br
of their country, their country.
.in -10
.sp
Use the Editor to:
.L1 5 2 1
Locate all occurrences of the word, aid.
.L1
Locate all occurrences of the word, now.
.L1
Locate the second occurrence of the word, time.
.L1
Locate the phrase, their country.
.L1
Locate all occurrences of the word, patriotic.
.E1
.sp 2
I'm sure you had no problems.  Let's move on.
.PH "Copying and Repositioning Text"
.PP
You are really in for a treat.
The next two functions of discussion, "pick" and "put," offer
tremendous flexibility in file modification.  While quite
similar to the move command
in the Text Editor, they are a great deal more powerful.
.PP
The pick function is used to pick up or to copy lines of text
and place them into the "put" buffer.  There are currently two
put buffers:  the main, which holds the text last picked up, and
the alternate, which holds the text last deleted.  Each can be
put back into the file by using appropriate forms of the "put"
function.
.PP
This feature not only allows you to copy or to move text
from one place to another, but also gives you access to text that has
been deleted.
.PP
The "PICK" <F3> and the "PUT" <F4> keys give you access to the "pick"
and "put" functions.  Now for an example.  Suppose you have the
following file.
.sp
.in 20
Now is the time
.br
For all good men
.br
to come to the
.br
aid of their country
.in -20
.PP
Now, suppose you want to modify this file, such that the
first line also appears as the last line.  This is what you would do.
.sp
.in 5
Step 1:~~Position the cursor on line 1.
.br
Step 2:~~Depress the "PICK" key <F3>.
.br
Step 3:~~Move the cursor to the line
.br
~~~~~~~~~following the last line.
.br
Step 4:~~Depress the "PUT" key <F4>.
.sp
The file now appears as:
.in +15
.sp
Now is the time
.br
For all good men
.br
to come to the
.br
Aid of their country
.br
Now is the time
.sp
.in -20
.ne 12
.in 6
.ti -6
Note: That line of text remains in the "put" buffer until
something else is picked up.  It may be placed in
any number of places within the file by moving the
cursor and depressing the "PUT" key <F4>.  What if
text is already there?  The Rand Editor designers
took that possibility into consideration and
designed the Rand Editor so that it will  make
room for the text in the "put" buffer.  It inserts a
line just before the line containing the cursor and
places the text in the "put" buffer there.
.in -6
.PP
Several lines may be placed into the "put"
buffer by either entering an argument or by moving the cursor
to indicate the number of lines to pick up.  Here is an example.
.sp
.in 10
To move 10 lines of text, you would:
.sp
Step 1: Position the cursor on the first
.br
~~~~~~~~line of text to be moved.
.br
Step 2: Depress the "BREAK" key.
.br
Step 3: Type the number "10."
.br
Step 4: Depress the "PICK" key <F3>.
.br
Step 5: Repeat steps 2 and 3.
.br
Step 6: Depress the "DEL LINE" key.
.br
Step 7: Move the cursor to the place
.br
~~~~~~~~within the file where the text
.br
~~~~~~~~in the "put" buffer is to be
.br
~~~~~~~~placed.
.br
Step 8: Depress the "PUT" key <F4>.
.in -10
.sp
.in 10
.ti -10
Notes: 1. In this example the main and the alternate buffers
will contain the same data.  Why?  The text picked
up was also deleted.  Notice that the text was moved,
not just copied.  Of course, we would omit steps 5
and 6, if the text were to be copied instead of moved.
.ti -10
~~~~~~~2. To place the text in the alternate buffer back into the
file, depress the "BREAK" key just before you hit the
"PUT" key <F4>.
.in -10
.sp 3
To pick up several lines by moving the cursor, you would:
.sp
.in 10
Step 1: Position the cursor on the first line of text
.br
~~~~~~~~to be picked up.
.br
Step 2: Depress the "BREAK" key.
.br
Step 3: Move the cursor down until it rests on the
.br
~~~~~~~~last line to be picked up.
.br
Step 4: Depress the "PICK" key <F3>.
.in -10
.sp
.ne 5
.in 6
.ti -6
Note: This procedure can be modified and used to pick up
portions of a line.  Even areas within the text
may be placed into the "put" buffer.
.in -6
.ne 10
.sp
To pick up a portion of a line, follow this procedure:
.in 10
.sp
Step 1: Position the cursor under the first character
.br
~~~~~~~~to be picked up.
.br
Step 2: Depress the "BREAK" key.
.br
Step 3: Move the cursor to just past the last character
.br
~~~~~~~~to be picked up.
.br
Step 4: Depress the "PICK" key <F4>.
.sp 2
.in 0
.PP
Since a portion of a line has been picked up, the text may be placed
within a line.  Suppose you had the following file:
.sp
.in 20
Now is the time!
.br
For all good men
.br
to come to the
.br
Aid of their country
.br
Now is the time
.PP
Here are the steps you would take to pick up "is the time!" from
line 1 and place it in line 5 between "Now" and "is."
.sp
.in 10
Step 1: Position the cursor under the "i" in "is"
.br
~~~~~~~~on line 1.
.br
Step 2: Depress the "BREAK" key.
.br
Step 3: Move the cursor to just past the "e" in
.br
~~~~~~~~"time."
.br
Step 4: Depress the "PICK" key <F3>.
.br
Step 5: Position the cursor under the "i" in "is"
.br
~~~~~~~~on line 5.
.br
Step 6: Depress the "PUT" key <F4>.
.in -10
.sp
Line 5 will now appear as:
.sp
.ti 10
Now is the time!is the time
.sp
.in 6
.ti -6
Note: Notice that the text is placed just before the cursor.
.in -6
.fi
.ne 15
.PP
If an entire line had been picked up and steps 5 and 6 were
performed, where would the editor have placed the text?  Answer  in
the space provided.
.sp 2
Answer: The editor would have placed the text just before line
5, not on line 5.  When an entire line is placed into the
"put" buffer, the editor expects it to occupy an entire
line some other place within the file.
.PP
Suppose you pick up a portion of a line, and you want to place
it on a line by itself.  Can it be done?  yes________   no________.
.sp
Answer: It certainly can.  The editor won't make room for it to
appear on a separate line, but you can by inserting a
blank line before depressing the "PUT" key <F4>.  Entire
areas of text may also be placed into the "put" buffer
by defining the area and then depressing the "PICK" key <F3>.
.PP
Do you recall how to define an area?  It is done by following a
procedure similar to that used in the section on removing text.
Follow these steps:
.sp
.in 5
Step 1: Position the cursor under the first character to
.br
~~~~~~~~be picked up in line 1 of the area.
.br
Step 2: Depress the "BREAK" key.
.br
Step 3: Move the cursor to just past the last character
.br
~~~~~~~~to be picked up in line 1.
.br
Step 4: Move the cursor downward, remaining in the same
.br
~~~~~~~~column until you reach the last line in the area
.br
~~~~~~~~to be picked up.
.br
Step 5: Depress the "PICK" key <F4>.
.PP
These two functions do not restrict you to the manipulation of text
in only one file.  Text may be copied or moved from one file to another
To determine what that encompasses, let's look at an example.
.PP
Suppose you are in the editor modifying the file "junk" when
you notice a paragraph that could be used in another file, "temp."
Here's what you would do to copy the paragraph:
.sp
.in 5
Step 1: Place the paragraph into the "put" buffer.
.br
Step 2: Depress the "BREAK" key.
.br
Step 3: Type the word "temp."
.br
Step 4: Press "USE" or <ctrl B>.
.sp
~~~~~~~~Note: This brings "temp" into the editor as
.br
~~~~~~~~the current file.
.sp
Step 5: Locate the place in "temp" where the paragraph
.br
~~~~~~~~is to be inserted.
.br
Step 6: Depress the "PUT" key.
.br
Step 7: Press "USE" or <ctrl B>.
.sp
~~~~~~~~Note: This is returns junk as the current file.
.in -5
Let's review what we've just covered by doing the following exercises.
.PH "Exercises"
Use the following file, RET, to answer the questions below.
.sp
.in 10
It's time!  It's time!
.br
It's Rand Editor time.
.br
Have some fun
.br
While you get the job done.
.br
Modify a file or two.
.br
You will be amazed
.br
At how quickly you are thru.
.br
And what used to seem a task,
.br
You'll now regret that it doesn't
.br
Last, and last and last.
.in -10
.L1 5 2 1
Move the first 4 lines and place them at the
end of the file.
.L1
Copy the next 3 lines beginning with "modify,"
and append them to the end of the file.
.L1
Put the first 4 lines back into the file via the
alternate buffer.
.L1
Pick up the phrase, Rand Editor time, and place it
as a heading in the file.
.L1
Copy the above file into another file called RET2.
.PH "Manipulating Files Simultaneously"
.PP
This feature truly exhibits the uniqueness of the UNIX System.  You
have seen how you can manipulate several files within a single editing
session.  However, only one file could be displayed at a time.
How would you like to be able to view several files simultaneously,
and with a minimum amount of effort be able to branch from one to another?
This option is yours by simply using  "MAKE PORT" or <ctrl Z>, "ENTER" or <ctrl C>, and
"SAVE" or <ctrl V> (some Delta Datas also use <ctrl V> instead of SAVE.)
.PP
First, let's discuss "MAKE PORT" or <ctrl Z>.  "MAKE PORT"  <ctrl Z>
is used to segment or subdivide the "window" in order to display more
than a single file.  As an example, you are editing the file "junk" when
you decide to compare it with the file "temp."  This is the sequence of
steps to follow: To divide the "window" horizontally, position the
cursor to reflect where the division is to take place.
.sp
.nf
  ---------------------------------------------------------
  |\&.so /usr/lib/tmac.nm                                   |
  |.de 44                                                 |
  |.ti 24                                                 |
  |UNCLASSIFIED                                           |
  |.br                                                    |
  |today is \\\\$1 the \\\\$2 of \\\\$3                         |
  |-                                                      |
  |.br                                                    |
  |..                                                     |
  |.44 tuesday 4th July                                   |
  |                                                       |
  ---------------------------------------------------------
				    File junk Line 6
  then type:      <break>
		 temp
		 <MAKE PORT>   <ctrl Z>

.ne 20
The "window" will now appear as:
  ...........................................................
  .\&.so /usr/lib/tmac.nm                                     .
  .\&.de 44                                                   .
  .\&.ti 24                                                   .
  .UNCLASSIFIED                                             .
  .\&.br                                                      .
  .\&today is \\\\$1 the \\\\$2 of \\\\$3                           .
  -----------------------------------------------------------
  |\&.so /usr/lib/tmac.nm                                     |
  |-                                                        |
  |\&.ds H1                                                   |
  |\&.ds Hr 7/28/78                                           |
  |\&.ds HL E53 memo                                          |
  |\&.ds CL SECRET                                            |
  |\&.L1 "" 0 a                                               |
  |This is text for Level one                               |
  -----------------------------------------------------------
				File temp Line 1
.fi
.PP
You may now manipulate the bottom of the "window" in the same
manner as if it were an entire "window."  That is, you may use any
of the keys or functions discussed prior to this.  Now to transfer
to the top of the "window" and the file "junk," you would press "ENTER"
<ctrl C>.  The "window" now appears as:
.sp 2
.ne 20
.nf
    ------------------------------------------------------------
    |.so /usr/lib/tmac.nm                                      |
    |.de 44                                                    |
    |.ti 24                                                    |
    |-                                                         |
    |UNCLASSIFIED                                              |
    |.br                                                       |
    |today is the \\\\$1 the \\\\$2 of \\\\$3                        |
    ------------------------------------------------------------
    ..so /usr/lib/tmac.nm                                      .
    ..ds H1                                                    .
    ..ds Hr 7/28/78                                            .
    ..ds HL E53 MEMO                                           .
    ..ds CL SECRET                                             .
    ..L1 " " 0a                                                .
    .This is the text for Level One                            .
    ............................................................
				      File Junk Line 3
.sp
.fi
.PP
Now answer this question in the space provided.
What do you think will happen if you type "ENTER" or <ctrl C> again?
.sp 2
You are correct if you said you are transferred back to the file at
the bottom of the "window." Now, to have "junk" occupy the entire
window again, type MAKE PORT or <ctrl Z>.
.PP
"MAKE PORT" or <ctrl Z> is not only used to create the small windows used  to
display the different files, but it is also used to erase the
small windows when they are no longer needed.  Simply depress the
"BREAK" key, then enter "MAKE PORT" or <ctrl Z> and the most recently created
window will no longer exist.  The next most recently created
window can be erased by hitting the "BREAK" key and entering
"MAKE PORT" or <ctrl Z> again.
.PP
You may segment either the large "window" or any subdivisions
of the large "window" horizontally or vertically.  Windows may be
formed horizontally by placing the cursor anywhere along the left
margin and typing "MAKE PORT" or <ctrl Z>.  This permits you to decide the size
of the smaller windows.
.sp
.in 6
.ti -6
Note: The same file may occupy more than 1 window.
Consequently, different parts of a file may be
simultaneously scanned or modified.
.in -6
.PP
To form windows vertically, the cursor is placed along the top
or bottom line of the "window".  The example below illustrates this.
.nf

   ---------------------------------------------------------------
   |.so /usr/lib/tmac.nm                                         |
   |.de 44                                                       |
   |.ti 24                                                       |
   |UNCLASSIFIED                                                 |
   |.br                                                          |
   |today is \\\\$1 the \\\\$2 of \\\\$3                               |
   |.br                                                          |
   |..                                                           |
   |.44 tuesday 4th July                                         |
   ---------------------------------------------------------------
				       File Junk Line 1
.sp
To do: Position the cursor at some point along the top line and
type the following:
.sp
			 <break>
			   temp
		     MAKE PORT <ctrl Z>
.sp
The window will appear as:
.ne 15
.sp
   ............................_________________________________
   ..so /usr/lib/tmac.nm      .|.so /usr/lib/tmac.nm           |
   .                          .|-                              |
   ..de 44                    .|.ds H1                         |
   ..ti 24                    .|.ds Hr 7/28/78                 |
   .UNCLASSIFIED              .|.ds Hl E53 MEMO                |
   ..br                       .|.ds CL SECRET                  |
   .today is \\\\$1 the \\\\$2 of .|.L1 " " 0 a                    |
   ..br                       .|This is a test                 |
   ...                        .|.L2                            |
   ..44 tuesday 4th July      .|This is a test                 |
   ............................|_______________________________|
				    File Temp Line 1
.sp
.fi
Now let's further subdivide junk by typing:
.in 20
.br
<ENTER>
.br
<position cursor on line 5>
.br
<break>
.br
 Junk2
.br
MAKE PORT <ctrl Z>
.in -20
.sp
.nf
.ne 20
     This will produce:

     ...........................................................
     ..so /usr/lib/tmac.nm       ..so/usr/lib/tmac.nm          .
     ..de 44                     ..ds H1                       .
     ..ti 24                     ..ds Hr 7/28/78               .
     .UNCLASSIFIED               ..ds HL E53 MEMO              .
     ..br                        ..ds CL SECRET                .
     ----------------------------..L1 " " 0a                   .
     |.so /usr/lib/tmac.nm      |.This is a test               .
     |-                         |.                             .
     |.PH "NM MACROS"           |..L2                          .
     |NM macros are commands    |. This is a test              .
     |ease the burden of format |.                             .
     |they are easily formed.   |.                             .
     |Outlines can be generated |.                             .
     --------------------------- ...............................
					 File Junk2 Line 1
.sp
.fi
.PP
Each of these little windows could also be further subdivided
either horizontally or vertically.  You are allowed to create a
maximum of 10 windows and it's perfectly fine to have two windows
displaying the same file.  We've determined that you can transfer
from one file to another file by typing ENTER <ctrl C>.  However, this
causes a transfer to the next previously established file.  eg.
Suppose you are modifying "Junk2" and you decide to make a change
in "junk."  This means that you would have to type ENTER <ctrl C> twice.
The first time ENTER <ctrl C> is typed, "temp" would become the current
file.  Therefore, ENTER <ctrl C> must be retyped in order for "junk" to become
the current file.
.PP
You can imagine how cumbersome this would be in manipulating several
windows.  Consequently, Unix has provided a better way.  It assigns
numbers sequentially to the windows as they are created.  Therefore,
to reference "junk," when "junk2" is the current file, you would type:
.sp
.ti 22
<break>
.br
.ti 25
1
.br
.ti 19
ENTER <ctrl C>
.sp
.PP
Okay, let's discuss SAVE <ctrl V>.   SAVE <ctrl V> allows you to "save" a file
without exiting the editor.  "Save a file" simply means that the current
version of the file is placed in your directory.  This can be of immense
benefit, especially if extensive modifications are to be performed
on a file.
.PP
Just as most systems break down occasionally, so does Unix.  When
this happens and you are in the editor, you will not have time to
save your files.  Therefore all the modifications to the file/files
will be lost.  Now, this will be of no real consequence if  you had
intermittently typed SAVE <ctrl V>, thereby causing the file to be continually
updated.  The current file may be saved by typing:
.sp
.ti 20
SAVE <ctrl V>
.sp
or, if you are editing more than one file, you would issue
the following for each file being edited:
.sp
.in 20
<break>
.br
<filename>
.br
SAVE <ctrl V>
.in -20
.sp
where "filename" is the name of one of the files being edited.
.PP
This feature can also prove to be quite advantageous in creating
large files.
.sp
.in 6
.ti -6
Note: SAVE <ctrl V> causes the updated versions to be
placed in your backup file.
.in -6
.PP
That isn't all, SAVE <ctrl V> can be used to rename a file by entering
the alternate filename as the argument.  This causes the current file to
appear in your directory under both names.  After leaving the editor,
you can then delete the old file.
.sp 2
.ne 20
Ready for another checkup?  O.K., let's have a go.
.PH "~~~~Exercise"
.sp
Use 3 of your existing files to perform the following:
.L1 5 2 1
Invoke the editor using the first file.
.L1
Enter the second file in vertically.
.L1
Transfer to the first file entered, and enter the third
file horizontally.
.L1
Transfer to the first file and scan a couple of pages.
.L1
Rename the second file "joy."
.L1
Remove the second and third files from the window.
.L1
Exit the editor and check your directory for the file
"joy."  Delete "joy."
.E1
.PH "Additional Information on the RAND Editor"
.PP
Several significent features of the RAND Editor have not been
discussed in this section. For a consideration of these features consult
"The CRT Text Editor NED - Introduction and Reference Manual."
A copy of this document should be available from your system
administrator.
.PH "Idiosyncrasies~of~the~RAND~Editor~on~Super~Bees:"
.PP
Due to certain differences between the Ann Arbor terminal, for
which the Rand editor was originally written, and the Superbee
terminal, peculiar behavior has been known to occur.
At time of this writing the Delta Data 7000 did not seem to have any
particular idiosyncrasies when used with the Rand Editor, so its users can
ignore this section.
.sp 2
.in 3
.ti -3
1.~During an editor session any of the following may happen:
.nf
       * Capital letters (A,B,C,or D) are echoed when using the
	cursor motion keys.
       * Cursor addresses (F011011) are echoed.
       * Other characters appear when manipulating text which
	you are sure are not in the file.
       * Dots fill the screen.
.fi
To respond to one of the above problems first press the <clear>  button.  If this doesn't erase the
erroneous characters, then you must delete them in the same manner as you
would any other character in the file.
.sp
.ti -3
2.~Most keys on the Super Bee Keyboard will repeat at a rate
of approximately 25 characters per second, if they are held down for
more than half a second.  This means that if you press <next page>,
for example, and hold it down, several pages from the file will be
displayed.  Thus, forcing you to wait until all those pages have been diplayed
before you can continue.  To avoid this, do not "lean" on the keyboard,
and allow the screen to settle before entering the next command.
Occasionally you'll lose control of the cursor; it'll start
moving accross the screen in a left to right and downward motion. To
regain control execute the following procedure:
.in 20
Press~~~~~Power Reset
.br
Press~~~~~Clear
.br
Press~~~~~On Line
.br
Press~~~~~Clear
.in -20
.sp
.ti -3
3.~In a previous unit, it was stated that a filename could contain
a maximum of 14 characters.  However, this statement now has to be
slightly altered, since the Rand Editor places the unmodified version
of a file into a backup file, and suffixes, .bak, to the file name.
It is recommended that the filename contain less than 9 characters to
ensure the retention of a backup file.
.sp
.ti -3
4.~Since the Rand Editor, as well as the Unix Text Editor, makes
no updates to files until a <rub out> is given, it will be unwise for
more than one user to simultaneously update the same file.
.PH "Diagnostics"
.PP
Below are listed some of the more common errors
encountered while using the Rand Editor.  They
are terminal-independent.
.L1 5 2 1
"Badkeyerr-editor error."
.br
Cause:  Self evident.
.br
Action: Hit another key.
.sp
.L1
"Argument must be numeric."
.br
.in +8
.ti -8
Cause:~~You provided a non-numeric argument to a function
expecting a number. For instance, typing <break> j
<stroll up> would cause the above error message to be
displayed since the number of lines must be a number.
.br
.ti -8
Action: Redo the function providing a positive number
as the argument.
.in -8
.sp
.L1
"Argument must be positive."
.br
.in +8
.ti -8
Cause:  You provided a negative number to function expecting
a positive number as in <break> -2 <ins line>.
.br
.ti -8
Action: Redo the function entering a positive number.
.in -8
.sp
.L1
"Nothing in pick buffer."
.br
.in +8
.ti -8
Cause:  You pressed <put> when no lines have been picked.
.br
.ti -8
Action: Use <pick> to identify the lines to <put>.
.in -8
.sp
.L1
"Can't put a window here."
.br
.in +8
.ti -8
Cause:  You placed the cursor in an unacceptable position
for window creation.
.br
.ti -8
Action: Position the cursor such that it is along the left,
top, or bottom margin.
.in -8
.sp
.L1
"Nothing to search for."
.br
.in +8
.ti -8
Cause:  You have pressed <+SEARCH> or <-SEARCH> without
specifying a search key.
.br
.ti -8
Action: Type <break>, enter an argument for the search key.
.in -8
.sp
.L1
"Search key not found."
.br
.in +8
.ti -8
Cause:  The string you specified as the search key (1) does
not exist, or (2) all occurences of the string have
already been found between the current cursor
position and the file end.  For <-SEARCH> one of the
above conditions exists between the current cursor
position and the beginning of the file.
.br
.ti -8
Action: No action required.
.in -8
.sp
.L1
"Can't make any more parts or windows."
.br
.in +8
.ti -8
Cause:  You have tried to create more than 10 windows on the
screen.
.br
.ti -8
Action: Discontinue window creation until you have removed
some of the existing ones.
.in -8
.ne 8
.sp
.L1
"You cannot modify this file."
.br
.in +8
.ti -8
Cause:  You have tried to alter a file and you don't have
the write privilege.
.br
.ti -8
Action: Exit the editor and change the mode of the file.
.in -8
.sp
.L1
"Feature not yet implemented."
.br
.in +8
.ti -8
Cause:  You have pressed some combination of keys that
the editor does not recognize.
.br
.ti -8
Action: Try something else.
.in -8
.sp
.L1
"Nothing in Put Buffer."
.br
.in +8
.ti -8
Cause:  You have pressed <break> <PUT> before any text
has been deleted.
.br
.ti -8
Action: Delete something then repeat <break> <PUT>.
.in -8
.sp
.L1
"Margin stuck, move cursor to free."
.br
.in +8
.ti -8
Cause:  You tried to type past the end of the line.
.br
.ti -8
Action: Move the cursor or move the window by using
Port<= or PORT =>.
.in -8
