script problem

How could I write a script to combine the like check numbers and add their charges, to create one line per check number with a total charge. example of lines:

check # check date charge
11211 01/03/06 10.00
11212 01/03/06 15.00
11212 01/03/06 20.00
11212 01/03/06 15.00
11213 01/03/06 5.00
11213 01/03/06 10.00

I want the script to make the lines look like this:

check # check date charge
11211 01/03/06 10.00
11212 01/03/06 50.00
11213 01/03/06 15.00

I'm not sure on the logic OR how to write it. I have AIX 4.3, Korn shell, and DBC utilities such as reformat, sort, etc..Thanks for any help.

Tommy

nawk -f td.awk myFile

td.awk:

{ arr[$1 OFS $2 ] += $3 ) }
END {
  for (i in arr)
   printf("%s%s%.2f\n", i, OFS, arr)
}

Little syntax error:

{ arr[$1 OFS $2 ] += $3 ) }

The right parenthesis should be removed.

{ arr[$1 OFS $2 ] += $3 }
END {
  for (i in arr)
   printf("%s%s%.2f\n", i, OFS, arr)
}

ooops - the remnants of the debuggin'.

thanks, tmarikle.