BEGIN { print "POCZATEK" sum = 0.0; } { country = $1; if ($2 > 40) print country, $2, NF sum += $2; } END { print "KONIEC" print "Sum of the 2nd columns is ", sum }