Replace Command [R]
Replaces lines with new text, either from Stdinx or from the Hold file.
REPLACE [ $HOLD ] rangelist
(Q=no printing, T=template, J=justified)
(Default: rangelist = *)
Replace $hold looks for new lines of text in the Hold file (see the Hold command) and uses each to replace one of the lines of the rangelist. Replace without $hold prints each line of rangelist, then waits for you to type a new line at the keyboard. Pressing Return only erases the line! Replacej indents the new line the same number of columns as the original line. $Hold can be abbreviated to $h.
Examples
/rq $hold 50/70 {replace from the Hold file} /rq $h 50/70 {replace from the Hold file} /rep 5 {replace line 5 only} 5 LINE 5 {prints existing contents} 5 NEW LINE 5 {prompts you with linenum}
Column Editing with $Hold
You can use the $hold option of the Replace command to do extensive column editing:
/lt @ ....+....10...+....20...+....30...+....40... 1 ***************** 2 * Page One * 3 ***************** 4 ***************** 5 * Page Two * 6 ***************** /holdq 4/6 {hold the second page of text} /deleteq 4/6 {now delete those lines} /set left 20 {set your left margin to starting column} /repq $hold 1/3 {overlay from the Hold file} /set left 1 {don't forget to reset left margin} /lt @ ....+....10...+....20...+....30...+....40... 1 ***************** ***************** 2 * Page One * * Page Two * 3 ***************** *****************
You can copy columns of text from one position in a line to another by setting margins with the Set Left and Set Right commands, holding the columns of text that you want to copy, setting new margins, and replacing the new column range with the text in the Hold file. Here is a command file that works on MPE V and MPE/iX which does all this for you:
COPYCOL.CMD.SYS parm fromcol,tocol,length,rangelist /set right /set left setjcw right := !fromcol + !length setjcw right := right - 1 /set right !right /set left !fromcol /holdq !rangelist setjcw right := !tocol + !length setjcw right = right - 1 /set left /set right !right /set left !tocol /replaceq $hold !rangelist /set right /set left
For example, to copy text from columns 1/5 to column 30 in all lines, you would enter:
/copycol 1 30 5 @