I used the below script to Sum up a field in a file based on some unique values. But the problem is when it is summing up the units, it is truncating to 2 decimals and not 6 decimals as in the input file (Input file has the units with up to 6 Decimals � Sample data below, when the units in the 2 rows below highlighted in red are added, I only get 2 decimal places 18.34).
awk -F "|" '{a[$2$3$4$5$6$7]+=$8;}END{for(i in a)print i"|"a;}' CONVFMT="%.6f" file1
ACCT1 XX 00548 02/13/2018 548JN4 L |18.424000
ACCT2 XY 00551 02/13/2018 540JC7 L |315.809000
ACCT3 XX 00639 02/13/2018 368024 L |4
ACCT5 XY 00663 02/13/2018 5210E1 L |18.344000
ACCT4 XX 00652 02/13/2018 546QD4 L |35.212000