I want to see just last sum here, but it shows me everything.
awk '{print sum += $1} END {print sum}' file.datThis is the output:
1.2
3.6
7.3
7.3 3 1 Answer
Considering you want sums in file.dat added together and then print them out, the line should be:
awk '{sum +=$1} END {print sum}' file.datTelling awk to print the sum every time you add a new value to sum makes it show each intermediate value, just as you have experienced.