121 lines
3.4 KiB
Groff
121 lines
3.4 KiB
Groff
.TH listtotable "" "" "/rdb Command"
|
|
.PC "Convert from list to table format"
|
|
\fBlisttotable [ \-el ] < \fIlistfile\fR
|
|
.PP
|
|
.II "list^convert to table"
|
|
.II "table^from list"
|
|
.II "convert list to table"
|
|
.B listtotable
|
|
converts a file in list format to table format.
|
|
Some
|
|
.B /rdb
|
|
programs must see files in table format,
|
|
so the conversion is necessary.
|
|
.PP
|
|
In addition, table-formatted files are processed faster than
|
|
list-formatted files.
|
|
Any time you send a list-formatted file through a pipe of two
|
|
or more programs, even if they can handle list format, convert
|
|
them to table format so that the programs
|
|
in the pipe will run two or three times faster on average.
|
|
.PP
|
|
The reason that table-formatted files run so much faster
|
|
is that a list file is often two or three times larger
|
|
than a table because of the repeated column names.
|
|
Therefore, when handling list-formatted files, the programs
|
|
have to process two or three times as many characters.
|
|
.SH Options
|
|
.B listtotable
|
|
recognizes the following options:
|
|
.IP \fB\-e\fR 0.3i
|
|
Expand each column to next tab stop.
|
|
Ordinarily, table columns heads are only as wide as list column heads.
|
|
.IP \fB\-l\fR
|
|
No head line in the list file.
|
|
This option makes it possible to convert and sometimes
|
|
use the older list-formatted files.
|
|
.sp \n(pDu
|
|
Earlier versions of
|
|
.B /rdb
|
|
did not require the leading newline in the list-formatted file; however,
|
|
this requirement was added by later editions of
|
|
.B /rdb
|
|
to make it easy for its commands to distinguish a list file from a table.
|
|
.SH "List and Table-Format Rules"
|
|
List format looks like this:
|
|
.DM
|
|
Number 1
|
|
Name Ronald McDonald
|
|
Company McDonald's
|
|
Street 123 Mac Attack
|
|
City Memphis
|
|
State TENN
|
|
ZIP 30000
|
|
Phone (111) 222-3333
|
|
.DE
|
|
.DM
|
|
Number 2
|
|
Name Chiquita Banana
|
|
Company United Brands
|
|
Street Uno Avenido de la Reforma
|
|
City San Jose
|
|
State Costa Rica
|
|
ZIP 123456789
|
|
Phone 1234
|
|
...
|
|
.DE
|
|
.PP
|
|
Remember there are three rules for constructing a list-format file:
|
|
.IP \fB1.\fR 0.3i
|
|
The
|
|
first character in the file is a newline.
|
|
Be sure that there are no
|
|
unseen spaces, tabs, or nonprinting characters on the first
|
|
line, or things will get quite messed up.
|
|
.IP \fB2.\fR
|
|
Each line consists of two columns separated by a tab.
|
|
The first column is gives the column's
|
|
name, and the second column gives its values.
|
|
.IP \fB3.\fR
|
|
A newline character follows each
|
|
.I row
|
|
(record).
|
|
.PP
|
|
And there are three rules for contructing a table, as follows:
|
|
.IP \fB1.\fR 0.3i
|
|
One tab between each column in a row, and a newline at the end.
|
|
.IP \fB2.\fR
|
|
Name of the column at the top of the column, in the first line of the file.
|
|
.IP \fB3.\fR
|
|
A dash line as the second line in the file.
|
|
.SH Example
|
|
The command
|
|
.DM
|
|
listtotable < maillist
|
|
.DE
|
|
.PP
|
|
converts list file
|
|
.B maillist
|
|
into table format.
|
|
The result appears as follows:
|
|
.DM
|
|
Number Name Company Street City State ZIP Phone
|
|
------- ------- ------- ------- ------- ------- ------- -------
|
|
1 Ronald McDonald McDonald's 123 Mac Attack Memphis
|
|
TENN 30000 (111) 222-3333
|
|
2 Chiquita Banana United Brands Uno Avenito De La
|
|
Revolution San Jose Costa Rica 123456789 1234
|
|
.DE
|
|
.PP
|
|
When you look at this messy table,
|
|
you can see the need for list format.
|
|
The information in each column is often too wide for the screen and
|
|
wraps around to the next line.
|
|
.SH "See Also"
|
|
.B
|
|
tabletolist
|
|
.R
|
|
.SH Notes
|
|
If you use this command with a table instead of a list file, you
|
|
will see a mess.
|