1 |
< |
.\" RCSid "$Id" |
1 |
> |
.\" RCSid "$Id$" |
2 |
|
.TH RCALC 1 4/6/99 RADIANCE |
3 |
|
.SH NAME |
4 |
|
rcalc - record calculator |
9 |
|
][ |
10 |
|
.B \-l |
11 |
|
][ |
12 |
+ |
.B \-p |
13 |
+ |
][ |
14 |
|
.B \-n |
15 |
|
][ |
16 |
|
.B \-w |
40 |
|
The |
41 |
|
.I \-tS |
42 |
|
option is used to specify an alternate tab character. |
43 |
+ |
.PP |
44 |
|
A |
45 |
|
.I \-i format |
46 |
|
option specifies a template for an alternate |
51 |
|
the format specification. |
52 |
|
In either case, if the format does not end with a newline, one will be added |
53 |
|
automatically. |
54 |
+ |
A special form of the |
55 |
+ |
.I \-i |
56 |
+ |
option may be followed immediately by a 'd' or an 'f' and an optional |
57 |
+ |
count, which defaults to 1, indicating the number of double or float |
58 |
+ |
binary values to read per record on the input file. |
59 |
+ |
If the input is byte-swapped, the |
60 |
+ |
.I \-iD |
61 |
+ |
or |
62 |
+ |
.I \-iF |
63 |
+ |
options may be substituted. |
64 |
+ |
If binary input is specified, no format string or file is needed. |
65 |
+ |
.PP |
66 |
|
A |
67 |
|
.I \-o format |
68 |
|
option specifies an alternate output record format. |
69 |
< |
It is interpreted the same as an input specification. |
69 |
> |
It is interpreted the same as an input specification, except that |
70 |
> |
the special |
71 |
> |
.I \-od |
72 |
> |
or |
73 |
> |
.I \-of |
74 |
> |
options do not require a count, as this will be determined by the |
75 |
> |
number of output channels in the given expressions. |
76 |
> |
If byte-swapped output is desired, the |
77 |
> |
.I \-oD |
78 |
> |
or |
79 |
> |
.I \-oF |
80 |
> |
options may be substituted. |
81 |
> |
.PP |
82 |
> |
The |
83 |
> |
.I \-p |
84 |
> |
option specifies "passive mode," where characters that do not |
85 |
> |
match the input format are passed unaltered to the output. |
86 |
> |
This option has no effect unless |
87 |
> |
.I \-i |
88 |
> |
is also specified, and does not make much sense unless |
89 |
> |
.I \-o |
90 |
> |
is also given. |
91 |
> |
With both input and output formats, the passive mode can |
92 |
> |
effectively substitute information in the middle of a file |
93 |
> |
or stream without affecting the rest of the data. |
94 |
> |
.PP |
95 |
|
The variable and function definitions in each |
96 |
|
.I \-f source |
97 |
|
file are read and compiled. |
105 |
|
option can be used to assign a string variable a string value. |
106 |
|
If this string variable appears in an input format, only records |
107 |
|
with the specified value will be processed. |
108 |
+ |
.PP |
109 |
|
The |
110 |
|
.I \-b |
111 |
|
option instructs the program to accept only exact matches. |
120 |
|
With the |
121 |
|
.I \-l |
122 |
|
option, the input format can match anywhere on a line. |
123 |
+ |
.PP |
124 |
|
The |
125 |
|
.I \-w |
126 |
|
option causes non-fatal error messages (such as division by zero) to |
234 |
|
This provides a convenient method for avoiding inappropriate calculations. |
235 |
|
The following library of pre-defined functions and variables is provided: |
236 |
|
.TP 10n |
237 |
+ |
.BR "in(n)" |
238 |
+ |
Return the value for input column |
239 |
+ |
.I n, |
240 |
+ |
or the number of columns available in this record if |
241 |
+ |
.I n |
242 |
+ |
is 0. |
243 |
+ |
This is an alternate way to get a column value instead of using |
244 |
+ |
the $N notation, and is more flexible since it is programmable. |
245 |
+ |
This function is disabled if an input format is used. |
246 |
+ |
.TP |
247 |
|
.BR "if(cond, then, else)" |
248 |
|
if cond is greater than zero, |
249 |
|
then is evaluated, otherwise else is evaluated. |
293 |
|
inverse trigonometric functions. |
294 |
|
.TP |
295 |
|
.BR "atan2(y, x)" |
296 |
< |
inverse tangent of y/x (range -pi to pi). |
296 |
> |
inverse tangent of y/x (range \-pi to pi). |
297 |
|
.SH EXAMPLE |
298 |
|
To print the square root of column two in column one, |
299 |
|
and column one times column three in column two: |
300 |
|
.IP "" .2i |
301 |
< |
rcalc -e '$1=sqrt($2);$2=$1*$3' inputfile > outputfile |
301 |
> |
rcalc \-e '$1=sqrt($2);$2=$1*$3' inputfile > outputfile |
302 |
|
.SH AUTHOR |
303 |
|
Greg Ward |
304 |
|
.SH BUGS |
308 |
|
.PP |
309 |
|
Tabs count as single spaces inside fields. |
310 |
|
.SH "SEE ALSO" |
311 |
< |
calc(1), cnt(1), ev(1), lam(1), tabfunc(1), total(1) |
311 |
> |
cnt(1), ev(1), getinfo(1), icalc(1), rlam(1), tabfunc(1), total(1) |