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