{"id":9,"description":"shell - sum numbers from stdin","tags":["shell","commands","tools"],"contents":["# Ways to sum up numbers from stdin or from piped output from previous commands","# Using paste command","$ echo somefile | paste -s -d+ | bc","$ cat nums | paste -sd+ - | bc","# using awk.. substitute $1 with the actual column number","$ cat nums | awk '{sum += $1} END {print sum}'"]}
