Bonbin Bonbin - 2 months ago 15
Linux Question

Sum numbers in row of text file (linux command terminal)

Say i have the numbers 6 1 4 in that format, what would be the best way to sum them so that i get the result 11 in the command terminal in linux using bash?

Answer

One Line Answer :

$echo "6 4 1" | awk '{print $1+$2+$3}'
11
Comments