| 19 |
|
][ |
| 20 |
|
.B \-o{f|d} |
| 21 |
|
][ |
| 22 |
+ |
.B "\-in M" |
| 23 |
+ |
][ |
| 24 |
+ |
.B "\-on M" |
| 25 |
+ |
][ |
| 26 |
|
.B \-tC |
| 27 |
|
][ |
| 28 |
|
.B \-N |
| 68 |
|
.I \-m |
| 69 |
|
option can be used to compute the mean rather than the total. |
| 70 |
|
For sums, the arithmetic mean is computed. |
| 71 |
+ |
If a power is also specified using the |
| 72 |
+ |
.I \-s |
| 73 |
+ |
option, the inverse power will be applied to the averaged result. |
| 74 |
|
For products, the geometric mean is computed. |
| 75 |
|
(A logarithmic sum of absolute values is used to avoid overflow, and |
| 76 |
|
zero values are silently ignored.) |
| 94 |
|
.PP |
| 95 |
|
A count can be given as the number of lines to read before |
| 96 |
|
computing a result. |
| 97 |
< |
By default, |
| 97 |
> |
Normally, |
| 98 |
|
.I total |
| 99 |
< |
reads each file to its end before producing its result, but the |
| 99 |
> |
reads each file to its end before producing its result, |
| 100 |
> |
but this behavior may be overridden by inserting blank lines in |
| 101 |
> |
the input. |
| 102 |
> |
For each blank input line, total produces a result as if the |
| 103 |
> |
end-of-file had been reached. |
| 104 |
> |
If two blank lines immediately follow each other, total closes |
| 105 |
> |
the file and proceeds to the next one (after reporting the result). |
| 106 |
> |
The |
| 107 |
|
.I \-N |
| 108 |
|
option (where N is a decimal integer) tells |
| 109 |
|
.I total |
| 112 |
|
In addition, the |
| 113 |
|
.I \-r |
| 114 |
|
option can be specified to override reinitialization and thus |
| 115 |
< |
give a running total every N lines. |
| 115 |
> |
give a running total every N lines (or every blank line). |
| 116 |
> |
This option also turns off the usual output flushing at each total. |
| 117 |
|
If the end of file is reached, the current total is printed |
| 118 |
|
and the calculation is reset before the next file (with or without the |
| 119 |
|
.I \-r |
| 120 |
|
option). |
| 121 |
|
.PP |
| 122 |
|
The |
| 123 |
+ |
.I \-in |
| 124 |
+ |
option if present, will limit the number of input records read |
| 125 |
+ |
(per input file). |
| 126 |
+ |
The |
| 127 |
+ |
.I \-on |
| 128 |
+ |
option may be used to limit the total number of outut records produced. |
| 129 |
+ |
.PP |
| 130 |
+ |
The |
| 131 |
|
.I \-tC |
| 132 |
|
option can be used to specify the input and output tab character. |
| 133 |
|
The default tab character is TAB. |
| 134 |
|
.PP |
| 112 |
– |
At least one set of totals is produced for each input file. |
| 135 |
|
If no files are given, the standard input is read. |
| 136 |
< |
If a file contains any blank lines, then the total is reported |
| 115 |
< |
at that point as if it constituted the end of file, and the tallies |
| 116 |
< |
are reset. |
| 117 |
< |
.SH EXAMPLE |
| 136 |
> |
.SH EXAMPLES |
| 137 |
|
To compute the RMS value of colon-separated columns in a file: |
| 138 |
|
.IP "" .2i |
| 139 |
< |
total -t: -m -s2 input |
| 139 |
> |
total \-t: \-m \-s2 input |
| 140 |
|
.PP |
| 141 |
|
To produce a running product of values from a file: |
| 142 |
|
.IP "" .2i |
| 143 |
< |
total -p -1 -r input |
| 143 |
> |
total \-p \-1 \-r input |
| 144 |
|
.SH BUGS |
| 145 |
|
If the input files have varying numbers of columns, mean values |
| 146 |
|
will certainly be off. |
| 151 |
|
.SH AUTHOR |
| 152 |
|
Greg Ward |
| 153 |
|
.SH "SEE ALSO" |
| 154 |
< |
cnt(1), neaten(1), rcalc(1), rlam(1), tabfunc(1) |
| 154 |
> |
cnt(1), neaten(1), rcalc(1), rcollate(1), rlam(1), rsplit(1), tabfunc(1) |