___________每一天都是幸福的!!
1. 数据格式
id1,n1
id2,n2
...
要对每个id进行一个n的加和
1 cat file1 | awk -F"," '{if(n[$1]>0){n[$1]=n[$1]+$2} else{n[$1]=$2}} END{for(k in n){print k","n[k]}}' > res
这个主要利用了awk的数组
Copyright @ 2024 symons Powered by .NET 8.0 on Kubernetes Powered by: .Text and ASP.NET Theme by: .NET Monster