Files

88 lines
2.2 KiB
Groff

.TH union "" "" "/rdb Command"
.PC "Concatenate tables"
\fBunion \fItableorlist ... \fB[\-] [< \fItableorlist \fB]\fR
.PP
.II "table^concatenate"
.II "concatenate tables"
The command
.B union
concatenates all of the
.IR tableorlist s
named on the command to form a new table or list.
The new table or list contains
all the rows in the first input table or list followed
by the rows of the second, and so on.
The input tables or lists must have the same number of columns.
It is best that the columns have the same name and the same type
of data, in the same order.
.PP
The hyphen `-' tells where in the list of files the standard input is to go.
This gives you the freedom to use
.B union
in a pipe and to place the input file anywhere in the output.
.SH Example
Consider table
.BR journal ,
as follows:
.DM
Date Amount Account Ref Description
---- ------ ------- --- -----------
820107 14.00 meal v meal with jones
820119 81.72 vitamin c sundown vitamins
820121 20.83 meal v meal with scott
820121 2500.00 keogh c keogh payment
820125 99.00 dues v dues to uni-ops
.DE
.PP
and table
.BR carexpense ,
as follows:
.DM
Date Amount Account Ref Description
---- ------ ------- --- -----------
820113 101.62 car v car repairs
820114 81.80 insur c car insurance allstate
820114 93.00 car c car registration dmv
.DE
.PP
The command
.DM
union journal carexpense
.DE
.PP
produces the following output:
.DM
Date Amount Account Ref Description
---- ------ ------- --- -----------
820107 14.00 meal v meal with jones
820119 81.72 vitamin c sundown vitamins
820121 20.83 meal v meal with scott
820121 2500.00 keogh c keogh payment
820125 99.00 dues v dues to uni-ops
820113 101.62 car v car repairs
820114 81.80 insur c car insurance allstate
820114 93.00 car c car registration dmv
.DE
.PP
The command
.DM
echo journal | union - carexpense
.DE
.PP
accomplishes the same thing as the previous example,
but shows demonstrates how to use
.B union
with a pipe.
.SH "See Also"
.B
jointable,
split
.R
.br
COHERENT Lexicon:
.B
cut,
paste
.R
.SO union