137 lines
3.0 KiB
Groff
137 lines
3.0 KiB
Groff
.TH append "" "" "/rdb Command"
|
|
.PC "Add a row to a table and update index tables"
|
|
\fBappend [\-h \-m[bhirs]] \fItable \fB[\fIkeycolumn ...\fB] < \fItableorrow\fR
|
|
.PP
|
|
.II "row^append to table"
|
|
.II "table^append row"
|
|
.II "append row to table"
|
|
The command
|
|
.B append
|
|
appends the row in table
|
|
.I tableorrow
|
|
onto the end of
|
|
.IR table .
|
|
It also updates the appropriate index table so that the
|
|
next search will find it.
|
|
For the
|
|
.I record
|
|
method of indexing,
|
|
.B append
|
|
adds the new record's offset to the end of the index table.
|
|
For the
|
|
.I inverted
|
|
method of indexing, it adds the record and then sorts the table.
|
|
.SH Options
|
|
.B append
|
|
recognizes the following options:
|
|
.IP \fB\-h\fR
|
|
.I tableorrow
|
|
has no
|
|
.B /rdb
|
|
head line and dash line.
|
|
This option is useful when you only have a row to append to a table,
|
|
but it does not have a head line.
|
|
.IP \fB\-m[bhirs]\fR
|
|
Use a fast-access method.
|
|
See the manual page for
|
|
.B search
|
|
for a description of the fast-access methods and how to invoke them.
|
|
.SH Example
|
|
Consider the table
|
|
.BR inventory ,
|
|
which is defined 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
|
|
This table has an index table, called
|
|
.BR record ,
|
|
which appears as follows:
|
|
.DM
|
|
Offset
|
|
--------
|
|
76
|
|
113
|
|
147
|
|
177
|
|
207
|
|
245
|
|
283
|
|
.DE
|
|
.PP
|
|
Finally, consider the table
|
|
.BR newrecord ,
|
|
which is as follows:
|
|
.DM
|
|
Item Amount Cost Value Description
|
|
---- ------ ---- ----- -----------
|
|
8 35 105 0 pipettes
|
|
.DE
|
|
.PP
|
|
Note that
|
|
.B newrecord
|
|
has the same columnar layout as
|
|
.BR inventory .
|
|
.PP
|
|
The following command appends
|
|
.B newrecord
|
|
onto the end of
|
|
.BR inventory:
|
|
.DM
|
|
append -mr inventory < newrecord
|
|
.DE
|
|
.PP
|
|
After
|
|
.B append
|
|
has done its work,
|
|
.B inventory
|
|
appears 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
|
|
8 35 105 0 pipettes
|
|
.DE
|
|
.PP
|
|
.BR inventory 's
|
|
index table now appears as follows:
|
|
.DM
|
|
Offset
|
|
--------
|
|
76
|
|
113
|
|
147
|
|
177
|
|
207
|
|
245
|
|
283
|
|
313
|
|
.DE
|
|
.PP
|
|
The new ``313'' entry in the secondary index table
|
|
.B inventory.r
|
|
is the offset to record 8 \(em that is,
|
|
the number of bytes for the beginning of the file to record 8.
|
|
.SH "See Also"
|
|
.B
|
|
delete,
|
|
index,
|
|
replace,
|
|
search
|
|
.R
|
|
.SO append
|