Dec 16, 2009

Summing intergers in a file

Method : 1

awk '{s+=$0}END{print s}' file

Method : 2

echo $(tr "\n" "+" < file)0|bc