REPLACE [ EDIT/3000:Reference Manual ] MPE/iX 5.0 Documentation
EDIT/3000:Reference Manual
REPLACE
3-86. REPLACE COMMAND
3-87. Purpose.
The REPLACE command replaces one or more lines in the WORK file.
3-88. Form.
The form of the REPLACE command is
R[EPLACE][Q] [rangelist] [,HOLD[Q] [,NOW]]
3-89. Description.
Entire lines are replaced by a REPLACE command. (Use the CHANGE or
MODIFY commands if you want to change characters within a line.) If an
entry in rangelist is a colnum or a string (signifying that only that
column or string is to be replaced), the REPLACE command ignores this and
replaces the entire line. If no rangelist is specified in the REPLACE
command, or if an asterisk (*) is specified in rangelist, the REPLACE
command replaces the line containing the current location of the pointer.
In an interactive session, EDIT/3000 displays the line number and the
contents of the line to be replaced, then displays the line number again
on the next line (unless the REPLACEQ form of the command has been used,
in which case only the line number is displayed). Enter the replacement
text and press RETURN. The new text replaces the old line. Pressing
RETURN only (with no replacement text) deletes the contents of the line
but not the line itself (the line number still exists; the contents are
blank).
When all lines of a range have been replaced, EDIT/3000 prompts for the
first line in the next range (if any) in rangelist, or terminates the
command if this was the last (or only) range in rangelist.
Pressing CONTROL Y in an interactive session will terminate the
replacement of lines in a range, or terminate the REPLACE command if this
is the last (or only) range in rangelist.
In batch mode, the REPLACE command replaces lines with new text records
entered following the REPLACE command.
Text from the HOLD file can be used to replace existing lines in the WORK
file by adding the HOLD [Q] or HOLD [Q],NOW parameters to the REPLACE
command. See paragraph 3-91, EXAMPLES.
3-90. Limitations.
The REPLACE command operates only within the margins established by the
SET LEFT, SET RIGHT (see paragraph 3-92) options in effect. Only that
text within the left and right margins is displayed and only that part of
the line is replaced. The replacement line is padded with blanks if it
is shorter, while a warning message is displayed if the string is longer
than the LEFT/RIGHT range.
When the HOLD parameter is used with the REPLACE command, text is
replaced on a line-for-line basis. For example, if three lines are to be
replaced, then only three lines will be accepted from the HOLD file. Or,
if there are only three lines in the HOLD file, only that many lines will
be replaced in the WORK file even if range specifies more than three
lines.
3-91. Examples.
The following examples illustrate the use of the REPLACE command and show
the location of the pointer at the conclusion of each command.
* REPLACE range
With this form of the REPLACE command (in an interactive session),
EDIT/3000 displays the line to be replaced, then prompts for the new text
with the line number. The new text is entered and replaces the text
originally contained in the line.
/LIST ALL
1 1 -2. WHAT IS EDIT/3000?
2
3 EDIT/3000 IS A SUBSYSTEM OF THE HP 3000
4 MULTIPROGRAMMING EXECUTIVE OPERATING SYSTEM
5 (MPE/3000) THAT IS USED TO CREATE AND
6 MANIPULATE ASCII FILE.
7
8 CHARACTERS, STRINGS OF CHARACTERS, OR ENTIRE
9 LINES OF CHARACTERS CAN BE INSERTED, DELETED,
10 REPLACED, MODIFIED, SEARCHED FOR, AND OTHERWISE
11 MANIPULATED BY USING EDIT/3000 COMMANDS.
/REPLACE 5
5 (MPE/3000) THAT IS USED TO CREATE AND
5 THIS IS A NEW LINE 5.
/FIND*
6 MANIPULATE ASCII FILES.
^ (1 )
/LIST 4/6
4 MULTIPROGRAMMING EXECUTIVE OPERATING SYSTEM
5 THIS IS A NEW LINE 5.
6 MANIPULATE ASCII FILES.
* REPLACEQ range
With this form, EDIT/3000 does not display the line to be replaced, but
does prompt with the line number.
In the example, the characters "(MPE/3000) THAT IS USED TO CREATE AND"
are entered after the prompt (5) is displayed. These characters replace
the old contents (THIS IS A NEW LINE) of line 5.
/LIST 5
5 THIS IS A NEW LINE 5.
/REPLACEQ 5
5 (MPE/3000) THAT IS USED TO CREATE AND
/FIND*
6 MANIPULATE ASCII FILES.
^ (1 )
/LIST 4/6
4 MULTIPROGRAMMING EXECUTIVE OPERATING SYSTEM
5 (MPE/3000) THAT IS USED TO CREATE AND
6 MANIPULATE ASCII FILES.
* REPLACE range, HOLD,NOW
This form of the REPLACE command (in an interactive session) causes
EDIT/3000 to display the line to be replaced, then the line from the HOLD
file which replaces it.
In the example, lines 3 through 6 are replaced by four lines from the
HOLD file.
1 1-2. WHAT IS EDIT/3000?
2
3 EDIT/3000 IS A SUBSYSTEM OF THE HP 3000
4 MULTIPROGRAMMING EXECUTIVE OPERATING SYSTEM
5 (MPE/3000) THAT IS USED 70 CREATE AND
6 MANIPULATE ASCII FILES.
7
8 CHARACTERS, STRINGS OF CHARACTERS OR ENTIRE
9 LINES OF CHARACTERS CAN BE INSERTED. DELETED,
10 REPLACED, MODIFIED, SEARCHED FOR, AND OTHERWISE
11 MANIPULATED BY USING EDIT/3000 COMMANDS.
/HOLDQ 8/11
CLEAR HOLD? Y
HOLD FILE LENGTH IS 4 RECORDS
/REPLACE 3/6,HOLD,NOW
3 EDIT/3000 IS A SUBSYSTEM OF THE HP 3000
3 CHARACTERS, STRINGS OF CHARACTERS, OR ENTIRE
4 MULTIPROGRAMMING EXECUTIVE OPERATING SYSTEM
4 LINES OF CHARACTERS CAN BE INSERTED, DELETED,
5 (MPE/3000) THAT IS USED TO CREATE AND
5 REPLACED, MODIFIED, SEARCHED FOR, AND OTHERWISE
6 MANIPULATE ASCII FILES.
6 MANIPULATED BY USING EDIT/3000 COMMANDS.
/FIND*
7
^ (1 )
/LIST ALL
1 1-2. WHAT IS EDIT/3000?
2
3 CHARACTERS, STRINGS OF CHARACTERS, OR ENTIRE
4 LINES OF CHARACTERS CAN BE INSERTED, DELETED,
5 REPLACED, MODIFIED, SEARCHED FOR, AND OTHERWISE
6 MANIPULATED BY USING EDIT/3000 COMMANDS.
7
8 CHARACTERS, STRINGS OF CHARACTERS, OR ENTIRE
9 LINES OF CHARACTERS CAN BE INSERTED, DELETED,
10 REPLACED, MODIFIED, SEARCHED FOR, AND OTHERWISE
11 MANIPULATED BY USING EDIT/3000 COMMANDS.
* REPLACEQ,HOLD,NOW and REPLACEQ,HOLDQ,NOW
The REPLACEQ,HOLD,NOW form of the REPLACE command does not display the
lines to be replaced but does display the lines from the HOLD file. In
the following example, lines 3 through 6 are replaced by four lines from
the HOLD file.
The REPLACEQ,HOLDQ,NOW form does not display the lines to be replaced nor
the lines from the HOLD file. See the second command in the following
example.
/REPLACEQ 3/6,HOLD,NOW
3 CHARACTERS, STRINGS OF CHARACTERS, OR ENTIRE
4 LINES OF CHARACTERS CAN BE INSERTED, DELETED,
5 REPLACED, MODIFIED, SEARCHED FOR, AND OTHERWISE
6 MANIPULATED BY USING EDIT/3000 COMMANDS.
/REPLACEQ 3/6,HOLDQ,NOW
/LIST ALL
1 1-2. WHAT IS EDIT/3000?
2
3 CHARACTERS, STRINGS OF CHARACTERS, OR ENTIRE
4 LINES OF CHARACTERS CAN BE INSERTED, DELETED,
5 REPLACED, MODIFIED, SEARCHED FOR, AND OTHERWISE
6 MANIPULATED BY USING EDIT/3000 COMMANDS.
7
8 CHARACTERS, STRINGS OF CHARACTERS, OR ENTIRE
9 LINES OF CHARACTERS CAN BE INSERTED, DELETED
10 REPLACED, MODIFIED, SEARCHED FOR, AND OTHERWISE
11 MANIPULATED BY USING EDIT/3000 COMMANDS.
* CREATING A TWO-COLUMN FORMAT WITH THE REPLACE COMMAND
The example below shows how to replace portions of lines with lines from
the HOLD file to create a two-column format.
/ SET LEFT=1,RIGHT=20
/ADD
1 LINE 1 OF WORK FILE
2 LINE 2 OF WORK FILE
3 LINE 3 OF WORK FILE
4 LINE 4 OF WORK FILE
5 LINE 5 OF WORK FILE
6 LINE 6 OF WORK FILE
7 LINE 7 OF WORK FILE
8 LINE 8 OF WORK FILE
9 LINE 9 OF WORK FILE
10 LINE 10 OF WORK FILE
11 //
...
/HOLDQ 6/10
CLEAR HOLD? Y
HOLD FILE LENGTH IS 5 RECORDS
/SET RIGHT=40,LEFT=21
/REPLACEQ 1/5,HOLDQ,NOW
/SET LEFT=1
/DELETEQ 6/10
NUMBER OF LINES DELETED = 5
/LIST ALL
1 LINE 1 OF WORK FILE LINE 6 OF WORK FILE
2 LINE 2 OF WORK FILE LINE 7 OF WORK FILE
3 LINE 3 OF WORK FILE LINE 8 OF WORK FILE
4 LINE 4 OF WORK FILE LINE 9 OF WORK FILE
5 LINE 5 OF WORK FILE LINE 10 OF WORK FILE
MPE/iX 5.0 Documentation