我已提取以下格式的数据文件:
MRFRS0004,2019-04-30,610,610
MRFRS0004,2019-05-01,13,13
MRFRS0004,2019-05-01,3,3
MRFRS0004,2019-05-01,1012,1012
AMTRT68,2019-04-30,4341,0
AMTRT68,2019-04-30,495,495
AMTRT68,2019-04-30,142904,142904
AMTRT68,2019-04-30,447,447
RAMBBRAO,2019-04-30,4609,4609
RAMBBRAO,2019-05-01,3788,0
RAMBBRAO,2019-05-01,585,585
RAMBBRAO,2019-05-01,4609,4609
我需要如下输出:
MRFRS0004 2019-04-30 1028 1028
AMTRT68 2019-04-30 148187 143846
RAMBBRAO 2019-04-30 13591 9803
我们尝试了一些awk命令,但没有获得完整的输出:
awk '{arr[$1]+=$2} END {for (i in arr) {print i,arr[i]}}' $FILENAME
awk -F\" '{s += $3} {o += $4} END{print $1 ,$2 $3 $4 }' logtwo.txt