bash add numbers from stdin code example
Example: sum of output unix
perl -lne '$x += $_; END { print $x; }' < mydatafile
or
awk '{s+=$1} END {print s}' mydatafile
perl -lne '$x += $_; END { print $x; }' < mydatafile
or
awk '{s+=$1} END {print s}' mydatafile