Matching fields of rows and then operating

Hi All,
I was seaching for script for solaris 5.10 environmet to get a output file from Input file like this.
INPUT FILE----------------
1000KE,MINE,74748
1000KE,YOUR,123998
200KE,MINE,886049
50KE,MINE,474176
50KE,YOUR,379998
100KE,YOUR,999994
50KE,MINE,9601
50KE,YOUR,990393
1000KE,MINE,499997
100KE,YOUR,499998
100KE,MINE,999996

And OUTPUT FILE-----------------
1000KE,MINE,(74748+499997)
1000KE,YOUR,74748
200KE,MINE,886049
50KE,MINE,(474176+9601)
50KE,YOUR,(379998+990393)
100KE,YOUR,(999994+499998)
100KE,MINE,999996

LOGIC: Add third field ($3)of all rows and make it single row if 1st and 2nd Field are matching./OR/ Find & match 1st and 2nd filed and merge them with making sum of third field.

Thanks In Advance
Ashis

Use nawk or /usr/xpg4/bin/awk on Solaris.

awk -F, '{a[$1","$2]+=$3}END{for(i in a){printf("%s,%d\n", i,a)}}' file

Regards

awk -F"," '{ my_array[$1","$2]+=$3 } END { for (each_rec in my_array) printf("%s,%s\n", each_rec,my_array[each_rec])}' input_file > output_file

Perfact, That wored perfact,
Thanks a Lot to both of you.
:b: