sum numbers in a text file

 


bash add numbers in a list

pico test1.txt

1
2
3

use command below

paste -sd+ test1.txt | bc
6

Reference

https://stackoverflow.com/questions/3096259/bash-command-to-sum-a-column-of-numbers

Comments