awk
-
sed
is a similar program -
Sum up a list of numbers, 1 per line, outputting the list and the sum1:
<cmd> | awk '{ sum+=$1;print $1} END {print "Sum";print sum}'
Links:
- What does 2 in awk do?, Kaushik Gopal (HN)
sed
is a similar program
Sum up a list of numbers, 1 per line, outputting the list and the sum1:
<cmd> | awk '{ sum+=$1;print $1} END {print "Sum";print sum}'
Links: