69 lines
1.9 KiB
Groff
69 lines
1.9 KiB
Groff
.TH fixtotable "" "" "/rdb Command"
|
|
.PC "Converts fixed length format to /rdb table format"
|
|
\fBfixtotable \fIcolumn\fB\|[=\|\fIn1\fB,\fIn2\fB] ... < \fIfixtdb\fR
|
|
.PP
|
|
.II "table^convert format"
|
|
.II "table^fixed length"
|
|
.II "convert table format"
|
|
The command
|
|
.B fixtotable
|
|
converts a data base from fixed-length format to
|
|
variable length \fB/rdb\fR format.
|
|
It does so
|
|
by selecting \fIn2\fR bytes of data from table \fIfixtdb\fR,
|
|
beginning at the \fIn1\fR position for each \fIcolumn\fR specified.
|
|
It inserts tabs between columns and calls the
|
|
.B /rdb
|
|
command
|
|
.B compress
|
|
to remove leading and trailing blanks.
|
|
It generates
|
|
header records from the column names.
|
|
Column names that do not specify start position (\fIn1\fR) and
|
|
field width (\fIn2\fR) are considered empty columns, and appear
|
|
as such in the output.
|
|
Blank records are removed.
|
|
.SH Example
|
|
For example, let's look at a file named \fBjournal\fR:
|
|
.DM
|
|
1 10 20 30
|
|
----+----|----+----|----+----|
|
|
820102101 25000
|
|
820102211.1 25000
|
|
820103150.1 10000
|
|
820103101 5000
|
|
820103211.2 5000
|
|
820104130 30000
|
|
.DE
|
|
.PP
|
|
The first six bytes are the date field;
|
|
the next six bytes, starting at position 7 are the account number field;
|
|
the next seven bytes, starting at position 13 are the credit field;
|
|
and the last seven bytes, starting at position 20 are the debit field.
|
|
.PP
|
|
The following command yanks
|
|
the account number and the credit and debit fields from
|
|
.BR journal ,
|
|
makes a new table with a new field for the description:
|
|
.DM
|
|
fixtotable Account=7,6 Debit=13,7 Credit=20,7 Description < journal
|
|
.DE
|
|
.PP
|
|
This produces the following table:
|
|
.DM
|
|
Account Debit Credit Description
|
|
------- ----- ------ -----------
|
|
101 25000
|
|
211.1 25000
|
|
150.1 10000
|
|
101 5000
|
|
211.2 5000
|
|
130 30000
|
|
.DE
|
|
.SH "See Also"
|
|
.B
|
|
compress,
|
|
tabletofix
|
|
.R
|
|
.SO fixtotable
|