Replacement String Commands [ HP FORTRAN 77/iX Migration Guide ] MPE/iX 5.0 Documentation
HP FORTRAN 77/iX Migration Guide
Replacement String Commands
Replacement string commands are those that appear on the right side of
the R, N, G, and S commands.
Tag Fields
&n Put tag field n into the replacement string at the
current position. If n is not specified, use the entire
search string.
>n Substitute the nth tag field matched and shift it to
uppercase.
<n Substitute the nth tag field matched and shift it to
lowercase.
Fill Commands
*x Change the fill character to x (the default is the space
character).
^n Fill with fill character up to column n.
$n Move the rest of the replacement string so that it
terminates at column n.
Examples.
R/^2[a-zA-Z]//^7&/ Moves everything found starting at column 2
of the current line to column 7 if an
alphabetic character is found in column 2.
Then fills columns 2 through 6 with spaces.
R/^boy//girl/ Replaces boy only if it occurs at the
beginning of a line.
R/b.y//girl/ Replaces boy, bay, buy, bny, etc.
R/^6BEGIN//^9BEGIN/ Moves BEGIN, if found starting in column 6,
to column 9, but does not affect BEGIN found
anywhere else in the line.
MPE/iX 5.0 Documentation