awk '{s+=$0} END {print s}' /tmp/file.txt
paste -sd+ /tmp/file.txt | bc
Source: http://unstableme.blogspot.com/2009/11/sum-of-numbers-in-file-unix.html
awk '{s+=$0} END {print s}' /tmp/file.txt
paste -sd+ /tmp/file.txt | bc
Source: http://unstableme.blogspot.com/2009/11/sum-of-numbers-in-file-unix.html
No comments:
Post a Comment