100 lines
1.4 KiB
Groff
100 lines
1.4 KiB
Groff
.TH tabletosed "" "" "/rdb Command"
|
|
.PC "Convert table format to sed file format"
|
|
\fBtabletosed < \fItable \fB> \fIsedfile\fR
|
|
.PP
|
|
.II sed
|
|
.II "table^convert to sed commands"
|
|
The command
|
|
.B tabletosed
|
|
converts a two-column
|
|
.I table
|
|
into a file of
|
|
.B sed
|
|
statements that can be input to the
|
|
.B sed
|
|
stream editor.
|
|
.B sed
|
|
macros are in the form:
|
|
.DM
|
|
s/old/new/g
|
|
.DE
|
|
.PP
|
|
.B sed
|
|
can do many things, including word-for-word substitution.
|
|
.I sedfile
|
|
produced is used by the
|
|
.B /rdb
|
|
command
|
|
.BR translate .
|
|
It can be used for language translation (in a stiff, inflexible way)
|
|
and for other conversions of data bases.
|
|
.SH Example
|
|
Suppose we have a simple translation table, called
|
|
.BR ed.t "
|
|
.DM
|
|
English Deutch
|
|
------- -------
|
|
I Ich
|
|
love liebe
|
|
you dich
|
|
widgit
|
|
.DE
|
|
.PP
|
|
The following command turns
|
|
.B ed.t
|
|
into a file of
|
|
.B sed
|
|
editing instructions, called
|
|
.BR ed.sed.1 :
|
|
.DM
|
|
tabletosed < ed.t > ed.sed.1
|
|
.DE
|
|
.PP
|
|
.B ed.sed.1
|
|
appears as follows:
|
|
.DM
|
|
s/I/Ich/g
|
|
s/love/liebe/g
|
|
s/you/dich/g
|
|
.DE
|
|
.PP
|
|
We can now use
|
|
.B ed.sed.1
|
|
with
|
|
.B sed
|
|
or
|
|
.BR translate .
|
|
For example, if file
|
|
.B text
|
|
contains the sentence
|
|
.DM
|
|
I love you.
|
|
.DE
|
|
.PP
|
|
then typing
|
|
.DM
|
|
sed -f ed.sed.1 text
|
|
.DE
|
|
.PP
|
|
prints the following on the standard output:
|
|
.DM
|
|
Ich liebe dich.
|
|
.DE
|
|
.PP
|
|
You can also use this command to construct form letters.
|
|
.SH "See Also"
|
|
.B
|
|
translate
|
|
.R
|
|
.br
|
|
COHERENT Tutorials:
|
|
.B
|
|
Introduction to the sed Stream Editor
|
|
.R
|
|
.br
|
|
COHERENT Lexicon:
|
|
.B
|
|
sed
|
|
.R
|
|
.SO tabletosed
|