More often than not, I need to quickly need to see the sum of a column of numbers when I’m doing some processing on the GNU/Linux command line. For the sake of simplicity, let’s assume that you have the following output from some command line pipe:
$ cat numbers.txt
$ cat numbers.txt | paste -sd+ | bc
or if you want a running total:
$ cat numbers.txt | sed 's/^/.+/' | bc
Of course it is possible to use Python, or simply invoke Perl to do a lot of fancy processing but I think as far as simplicity goes, those two solutions, especially the first one, is a nice addition to your Linux toolbox. Note that the first solution is really minimalist: the paste command is part of the GNU coreutils.