[root@www ~]# cat pc.txt
1 84
2 89
3 90
4 87
5 94
6 100
7 93
[root@www ~]# gawk '{if($2>=90) {amount["A"]++;score["A"]+=$2;} else if($2>=80&&$2<90) {amount["B"]++;score["B"]+=$2;}} END{for (i in amount) print i,amount[i],score[i]/amount[i]}' pc.txt
A 4 94.25
B 3 86.6667
自己去改写