我正在尝试获取一个看起来像的 csv 文件
customerID,firstname,lastname,charge
5efc522,Romo,goodrick,37.89
4a7f057,jeny,vel,38.39
5efc522,Romo,goodrick,39.00
并使其成为
firstname,lastname,chargetotal,customerID
ROMO,goodrick,76.89,5efc522
jeny,vel,38.39,4a7f057
到目前为止我知道我能做到
awk '{arr[$1]+=$4;}
END{
FOR (i in arr) {
print i, arr[i];}
'< file
任何帮助,将不胜感激