89 lines
2.3 KiB
Groff
89 lines
2.3 KiB
Groff
.TH difference "" "" "/rdb Command"
|
|
.PC "Output table of rows that are in only one table"
|
|
\fBdifference \fItable1 table2\fR
|
|
.PP
|
|
.II table^difference
|
|
.II table^subtract
|
|
.II "subtract tables"
|
|
.II sort
|
|
.II uniq
|
|
The command
|
|
.B difference
|
|
uses the COHERENT commands
|
|
.B sort
|
|
and
|
|
.B uniq
|
|
to subtract logically
|
|
.I table2
|
|
from
|
|
.IR table1 .
|
|
Its output consists of the rows that are in
|
|
.I table1
|
|
but not in
|
|
.IR table2 .
|
|
The two input tables must have the same columns
|
|
(\fIunion compatible\fR in the technical data-base literature),
|
|
and the rows must be exactly identical \(em including every space, tab,
|
|
and nonprinting character.
|
|
If two rows look the same to you but not to
|
|
.BR difference ,
|
|
try the
|
|
.B see
|
|
command to discover any blank spaces and nonprinting characters.
|
|
.SH Example
|
|
In this example, consider the table
|
|
.BR journal ,
|
|
which appears as follows:
|
|
.DM
|
|
Date Amount Account Ref Description
|
|
------- ------- ------- ------- --------------------------------
|
|
820107 14.00 meal v meal with jones
|
|
820113 101.62 car v car repairs
|
|
820114 81.80 insur c car insurance allstate
|
|
820114 93.00 car c car registration dmv
|
|
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 unix conference
|
|
.DE
|
|
.PP
|
|
And consider the table
|
|
.BR carexpense ,
|
|
which appears 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
|
|
difference journal carexpense
|
|
.DE
|
|
.PP
|
|
logically ``subtracts''
|
|
.B carexpense
|
|
from
|
|
.BR journal ,
|
|
to produce 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 unix conference
|
|
.DE
|
|
.SH "See Also"
|
|
COHERENT Lexicon:
|
|
.B
|
|
diff,
|
|
diff3,
|
|
sort,
|
|
uniq
|
|
.R
|
|
.SO difference
|