|
|
EDIT/3000 Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 3 EDIT/3000 COMMANDSREPLACE |
|
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. 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. The following examples illustrate the use of the REPLACE command and show the location of the pointer at the conclusion of each command.
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.
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.
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.
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.
The example below shows how to replace portions of lines with lines from the HOLD file to create a two-column format.
|
|