awk '{split ($1,a,";");sum[a[1]] += $NF;} END { for (s in sum) print s,sum;} myfile -- Not working
awk -F'[;]' '{ t[$1]+=$3 } END { for (i in t) print i, t }' -- myfile -- Not working
Thanks . When I tried to print the description using the below command I am getting only one description not sure what I am doing wrong
awk -F'[;]' '{ t[$1]+=$3 } END { for (i in t) print i,$2, t }' my file
INPUT
10264;ATE;12
10265;SES;11
10266;AUT;50
10264;ATE;10
10265;SES;13
10266;AUT;89
10264;ATE;1
10265;SES;15
10266;AUT;78
OUTPUT
10266 AUT 217
10264 AUT 23
10265 AUT 39
Expected
10266 AUT 217
10264 ATE 23
10265 SES 39
Also if I have the number as 1009090992.1111 the my result is coming as 1.00909e+09 how to get that as a whole number
Example:
10264;ATE;1009090992.1111
10265;SES;11
10266;AUT;50
10264;ATE;10
10265;SES;13
10266;AUT;89
10264;ATE;1
10265;SES;15
10266;AUT;78
Output
10264 ATE 1.00909e+09 --> I am trying with printf to get it work
10266 AUT 217
10265 SES 39