awk

awk排重并将第二行累加比如
1 100
2 200
3 300
2 400
3 500

结果是
1 100
2 600
3 800
使用awk方法为:
cat logfile | awk '{counts[$1]+=$2}END{for (x in counts){print x, counts[x]}}'

原文地址:https://www.cnblogs.com/feiqi/p/4895399.html