Bonbin Bonbin - 1 month ago 4x
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?


One Line Answer :

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