66 lines
1.4 KiB
Groff
66 lines
1.4 KiB
Groff
.TH substitute "" "" "/rdb Command"
|
|
.PC "Replace old string with new string"
|
|
\fBsubstitute \fIoldstring newstring file ...\fR
|
|
.PP
|
|
.II "string^replace"
|
|
.II "replace string"
|
|
The command
|
|
.B substitute
|
|
replaces
|
|
.I oldstring
|
|
with
|
|
.I newstring
|
|
throughout each
|
|
.IR file .
|
|
Because it uses the COHERENT command
|
|
.BR sed ,
|
|
be sure to protect with backslash `\e' all
|
|
.BR sed 's
|
|
special characters:
|
|
`*', `^', `$', and `\e'.
|
|
.SH Example
|
|
Again, consider table
|
|
.BR inventory ,
|
|
as follows:
|
|
.DM
|
|
Item Amount Cost Value Description
|
|
----- ------ ---- ----- --------------
|
|
1 3 50 150 rubber gloves
|
|
2 100 5 500 test tubes
|
|
3 5 80 400 clamps
|
|
4 23 19 437 plates
|
|
5 99 24 2376 cleaning cloth
|
|
6 89 147 13083 bunsen burners
|
|
7 5 175 875 scales
|
|
.DE
|
|
.PP
|
|
To replace string
|
|
.B rubber
|
|
with
|
|
.B latex
|
|
throughout
|
|
.BR inventory ,
|
|
type:
|
|
.DM
|
|
substitute 'rubber' 'latex' file
|
|
.DE
|
|
.PP
|
|
.B inventory
|
|
now appears as follows:
|
|
.DM
|
|
Item Amount Cost Value Description
|
|
----- ------ ---- ----- --------------
|
|
1 3 50 150 latex gloves
|
|
2 100 5 500 test tubes
|
|
3 5 80 400 clamps
|
|
4 23 19 437 plates
|
|
5 99 24 2376 cleaning cloth
|
|
6 89 147 13083 bunsen burners
|
|
7 5 175 875 scales
|
|
.DE
|
|
.SH "See Also"
|
|
COHERENT Lexicon:
|
|
.B
|
|
sed
|
|
.R
|