sum numbers in bash code example
Example 1: bash add all numbers
awk '{ sum += $1 } END { print sum }' file
Example 2: sum column bash
paste -sd+ infile | bc
# Using existing file
awk '{ sum += $1 } END { print sum }' file
paste -sd+ infile | bc
# Using existing file