add

NAME

add - add a column of numbers read from standard input

SYNTAX

add [OPTION]... [FILE]...

DESCRIPTION

Summarise a column of numbers read from FILE(s) to standard output.

With no FILE, read standard input.

Options select fields to be included in the summary:

-c
count
-s
sum
-m
mean
-d
standard deviation

Options may be combined. Summary fields are printed in the order the options were given, separated by spaces. If no options are given, -s is assumed.

The first recognisable number on each line is used.

The sum is given to the maximum decimal places of the input, the mean and standard deviation to one more place.

Times of the form HH:MM:SS are recognised and converted to seconds for calculations.

EXAMPLES

Add the numbers from 1 to 100:
ap 1 100 | add

Find count, sum, and mean of file sizes:

stat -t *.c | cut -d' ' -f2 | add -csm

AUTHOR

Written by Adam Curtin, Yellowduck Ltd.

REPORTING BUGS

Contact Us

COPYRIGHT

Copyright © 2003 Yellowduck Ltd
This is free software. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.