1 |
.\" RCSid "$Id" |
2 |
.TH TOTAL 1 2/3/95 RADIANCE |
3 |
.SH NAME |
4 |
total - sum up columns |
5 |
.SH SYNOPSIS |
6 |
.B total |
7 |
[ |
8 |
.B \-m |
9 |
][ |
10 |
.B \-sE |
11 |
| |
12 |
.B \-p |
13 |
| |
14 |
.B \-u |
15 |
| |
16 |
.B \-l |
17 |
][ |
18 |
.B \-tC |
19 |
][ |
20 |
.B \-N |
21 |
[ |
22 |
.B \-r |
23 |
]] |
24 |
[ |
25 |
file .. |
26 |
] |
27 |
.SH DESCRIPTION |
28 |
.I Total |
29 |
sums up columns of real numbers from one or more files |
30 |
and prints out the result on its standard output. |
31 |
.PP |
32 |
By default, |
33 |
.I total |
34 |
computes the straigt sum of each input column, but multiplication |
35 |
can be specified instead with the |
36 |
.I \-p |
37 |
option. |
38 |
Likewise, the |
39 |
.I \-u |
40 |
option means find the upper limit (maximum), and |
41 |
.I \-l |
42 |
means find the lower limit (minimum). |
43 |
.PP |
44 |
Sums of powers can be computed by giving an exponent with the |
45 |
.I \-s |
46 |
option. |
47 |
(Note that there is no space between the |
48 |
.I \-s |
49 |
and the exponent.) |
50 |
This exponent can be any real number, positive or negative. |
51 |
The absolute value of the input is always taken before the |
52 |
power is computed in order to avoid complex results. |
53 |
Thus, |
54 |
.I \-s1 |
55 |
will produce a sum of absolute values. |
56 |
The default power (zero) is interpreted as a straight sum without |
57 |
taking absolute values. |
58 |
.PP |
59 |
The |
60 |
.I \-m |
61 |
option can be used to compute the mean rather than the total. |
62 |
For sums, the arithmetic mean is computed. |
63 |
For products, the geometric mean is computed. |
64 |
(A logarithmic sum of absolute values is used to avoid overflow, and |
65 |
zero values are silently ignored.) |
66 |
.PP |
67 |
A count can be given as the number of lines to read before |
68 |
computing a result. |
69 |
By default, |
70 |
.I total |
71 |
reads each file to its end before producing its result, but the |
72 |
.I \-N |
73 |
option (where N is a decimal integer) tells |
74 |
.I total |
75 |
to produce a result and reset the calculation after |
76 |
every N input lines. |
77 |
In addition, the |
78 |
.I \-r |
79 |
option can be specified to override reinitialization and thus |
80 |
give a running total every N lines. |
81 |
If the end of file is reached, the current total is printed |
82 |
and the calculation is reset before the next file (with or without the |
83 |
.I \-r |
84 |
option). |
85 |
.PP |
86 |
The |
87 |
.I \-tC |
88 |
option can be used to specify the input and output tab character. |
89 |
The default tab character is TAB. |
90 |
.PP |
91 |
If no files are given, the standard input is read. |
92 |
.SH EXAMPLE |
93 |
To compute the RMS value of colon-separated columns in a file: |
94 |
.IP "" .2i |
95 |
total -t: -m -s2 input |
96 |
.PP |
97 |
To produce a running product of values from a file: |
98 |
.IP "" .2i |
99 |
total -p -1 -r input |
100 |
.SH BUGS |
101 |
If the input files have varying numbers of columns, mean values |
102 |
will certainly be off. |
103 |
.I Total |
104 |
will ignore missing column entries if the tab separator is a non-white |
105 |
character, but cannot tell where a missing column should have been if |
106 |
the tab character is white. |
107 |
.SH AUTHOR |
108 |
Greg Ward |
109 |
.SH "SEE ALSO" |
110 |
cnt(1), lam(1), neat(1), rcalc(1), tabfunc(1) |