SUM v2.00 - find sum of numbers in text file
Revised 2-Jan-99. Copyright (c) 1996-99 by Rune Berg. TextTools Freeware.

Usage | Description | Options | Example | Limitations | Return Codes | Version History | tt_r6


UsageTop | Next

sum [log logfile] [options] [infile] [to outfile]


DescriptionTop | Previous | Next

sum sums up numbers in infile until end-of-file or non-numeric data is found, and prints a one line result to outfile, e.g.:

        sum is 540

If all input numbers are integers, sum will print an integer result; if at least one input number is a floating point number, sum will print a floating point result.

If sum finds no numbers in infile, it will print:

        sum is unknown

If you don't specify infile, sum reads from standard input.
If you don't specify outfile, sum writes to standard output.
If you don't specify logfile, sum writes error messages to standard error.


OptionsTop | Previous | Next

sum recognizes the following command line options:

The functions -a -s -b -c -u can be used one at a time (to print just that kind of result), or combined (to print more than one result).


ExampleTop | Previous | Next

Given a file mydata.txt containing:

the command: will print:


LimitationsTop | Previous | Next

sum handles integer in the range -2147483647 .. 2147483647.

See separate discussion on floating point numbers for more details on that format.

sum does not detect underflows and overflows.


Return CodesTop | Previous | Next

sum returns with one of the following codes ("error levels"):


Version HistoryTop | Previous

These are the released versions:

End of document