12-04-2008
7,
0
Join Date: Dec 2008
Last Activity: 19 August 2009, 8:59 AM EDT
Location: India
Posts: 7
Thanks Given: 0
Thanked 0 Times in 0 Posts
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