88 lines
1.6 KiB
Groff
88 lines
1.6 KiB
Groff
.TH total "" "" "/rdb Command"
|
|
.PC "Sum a column"
|
|
\fBtotal [ \-l ] [ \fBcolumn ...\fB ] < \fItable\fR
|
|
.PP
|
|
.II "column^add"
|
|
.II table^add
|
|
The command
|
|
.B total
|
|
adds up the values in each
|
|
.I column
|
|
in
|
|
.IR table .
|
|
If no
|
|
.I column
|
|
is named on the command line,
|
|
it totals every column in
|
|
.IR table .
|
|
.PP
|
|
The option
|
|
.B \-l
|
|
prints the entire table as well as the total for each
|
|
.IR column .
|
|
.PP
|
|
Several other commands behave just like
|
|
.BR total ,
|
|
except that the value they produce is not a total but:
|
|
.BR datatype ,
|
|
.BR maximum ,
|
|
.BR minimum ,
|
|
.BR mean ,
|
|
.BR precision ,
|
|
.BR width ,
|
|
.BR length ,
|
|
and so on.
|
|
The all call the same program, but decide
|
|
what to print depending upon the name used to call it.
|
|
.SH Example
|
|
There are two formats.
|
|
Without the option
|
|
.BR \-l ,
|
|
.B total
|
|
just gives the head lines and the total line.
|
|
For example, to find the totals of columns
|
|
.B Debit
|
|
and
|
|
.B Credit
|
|
in table
|
|
.BR journal ,
|
|
type:
|
|
.DM
|
|
total Debit Credit < journal
|
|
.DE
|
|
.PP
|
|
This returns something like:
|
|
.DM
|
|
Date Account Debit Credit Description
|
|
---- ------- ----- ------ -----------
|
|
65000 65000
|
|
.DE
|
|
.PP
|
|
However, if you wish to see the whole table, as in a report, type:
|
|
.DM
|
|
total -l Debit Credit < ledger
|
|
.DE
|
|
.PP
|
|
This returns something like:
|
|
.DM
|
|
Account Date Debit Credit
|
|
------- ------- ------- -------
|
|
101 890102 25000
|
|
101 890103 5000
|
|
101 890104 15000
|
|
130 890104 30000
|
|
150.1 890103 10000
|
|
201.1 890104 15000
|
|
211.1 890102 25000
|
|
211.2 890103 5000
|
|
------- ------- ------- -------
|
|
65000 65000
|
|
.DE
|
|
.SH "See Also"
|
|
.B
|
|
maximum,
|
|
mean,
|
|
minimum,
|
|
subtotal
|
|
.R
|