【发布时间】:2017-04-27 20:03:07
【问题描述】:
这或多或少是 Using awk to sum the values of a column, based on the values of another column, append the sum and percentage to original data 的变体,但匹配两个字段而不是一个。
输入:
a;x;1
b;y;2
a;x;3
想要的结果:
a;x;1;4;25.00
b;y;2;2;100.00
a;x;3;4;75.00
因此,如果第 1 列和第 2 列中的字段相等,则将它们的第 3 列相加并附加结果。另外,附加百分比。
【问题讨论】:
标签: awk sum append percentage