输入文件 abc.txt 具有 COUNTS 和 NUM 列,我想分别为所有 COUNTS 和 NUM 求和。一旦 COUNT 是最后一条记录(一个块),那么 NUM 就是最后一条记录(另一个块)。
COMPANY : ALL COMPANIES
REQUEST TYPE DESCRIPTION COUNTS
A1 ABC (1 2 3) 107
A2 O REATE (NOT AUTHORIZED) 3
A3 NEW OR OLD TC 9
b1 NOTIFY ACTIVE 2
b2 CANCEL T 8
AA CANCEL SERVICE 0
AC ACKNOWLEDGE 0
AB ACTIVE 128
ALL COMPANIES
REQUEST TYPE DESCRIPTION COUNTS NUM
A1 ABC (1 2 3) 107 01
A2 O REATE (NOT AUTHORIZED) 3 01
A3 NEW OR OLD TC 9 03
b1 NOTIFY ACTIVE 2 04
b2 CANCEL T 8 05
AA CANCEL SERVICE 0 07
AC ACKNOWLEDGE 0 08
AB ACTIVE 128 09