Bonbin Bonbin - 1 year ago 104
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 Source

One Line Answer :

$echo "6 4 1" | awk '{print $1+$2+$3}'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download