BEGIN { total = 0 }
{ total += $2; print NR, $1, $2 }
END { print "total", total }
---
apple 12
pear 7
peach 9
