perl -F: -wane '$t{$F[0]}+=$F[2]; $c{$F[0]}++; END{printf "%s: %f\n", $_, $t{$_}/$c{$_} for keys %c}' file