BEGIN { FS = ","; OFS = ","; } { Sum += ($1*$2); Div += ($2); } END { print Sum/Div }