Rdb: Ruby-Nachbau der MWC /rdb-Werkzeuge

This commit is contained in:
wkh
2026-10-11 20:33:17 +02:00
commit a9990169e9
308 changed files with 16738 additions and 0 deletions
+101
View File
@@ -0,0 +1,101 @@
.TH subtotal "" "" "/rdb Command"
.PC "Output subtotals of columns in a table
\fBsubtotal [ \-l ] [ \fIbreak-column column ... \fB] < \fItable\fR
.PP
.II column^subtotal
.II "column^compute subtotal"
The command
.B subtotal
computes subtotals in each numeric
.I column
within
.IR table .
.PP
.B subtotal
uses
.I break-column
to mark where computation should begin and end:
as long as a value in
.I break-column
remains the same, the values in the other columns are accumulated.
When the value in the
.I break-column
changes,
.B subtotal
prints the value or values accumulated since the last break.
.PP
If no columns are specified on the command line,
.B splittable
uses the first, or leftmost, column of the table as the
break column, and computes subtotals for all other columns.
.PP
The option
.B \-l
prints whole table, not just the subtotals.
.SH Example
There are two forms of output.
One produces only the subtotals.
If you wanted to see the daily subtotals of table
.BR journal ,
type:
.DM
subtotal Date Debit Credit < journal
.DE
.PP
This produces something like the following:
.DM
Date Account Debit Credit Description
------ ------- ----- ------ ----------------------------------
891222 25000 25000
891223 10000 10000
891224 30000 30000
.DE
.PP
Note that columns
.B Description
and
.B Account
are blank, because they contain non-numeric data.
.PP
The
.B \-l
prints the entire table, as well as the subtotals.
For example, the command
.DM
subtotal -l Date Debit Credit < journal
.DE
.PP
produces:
.DM
Date Account Debit Credit Description
------ ------- ----- ------ ----------------------------------
891222 101 25000 cash from loan
891222 211.1 25000 loan number #378-14 Bank Amerigold
------ ------- ----- ------ ----------------------------------
891222 25000 25000
.DE
.DM
891223 150.1 10000 test equipment from Zarkoff
891223 101 5000 cash payment
891223 211.2 5000 note payable to Zarkoff Equipment
------ ------- ----- ------ ----------------------------------
891223 10000 10000
.DE
.DM
891224 130 30000 inventory - parts from CCPSC
891224 201.1 15000 accounts payable to CCPSC
891224 101 15000 cash payment to CCPSC for parts
------ ------- ----- ------ ----------------------------------
891224 30000 30000
.DE
.PP
This lets you see each row as well as the subtotals.
This could help you find out when you got out of balance.
.SH "See Also"
.B
compute,
maximum,
mean,
minimum
.R
.SO subtotal