adding field values if field matches

hi

i have file as below , i want to add duplicate records like bell_bb to one record with valuve as 15 ( addition of both )

any oneline awk script to achive this ?

header 0
CAMPAIGN_NAME 1
 Bell_BB 14
Bell_MONTHLY 803
SOLO_UNBEATABLE 644
Bell_BB 1
Bell_MONTHLY 25
SOLO_UNBEATABLE 78

can you give an example of what is the input and what is the output you are expecting.

awk '{a[$1]+=$2}END{for(i in a){print i, a}}' file

Input

header 0
CAMPAIGN_NAME 1
 Bell_BB 14
Bell_MONTHLY 803
SOLO_UNBEATABLE 644
Bell_BB 1
Bell_MONTHLY 25
SOLO_UNBEATABLE 78

Output repuired

header 0
CAMPAIGN_NAME 1
 Bell_BB 15
Bell_MONTHLY 828
SOLO_UNBEATABLE 722

---------- Post updated at 08:33 AM ---------- Previous update was at 08:31 AM ----------

Thanks Franklin its working fine as per expectation :b:

To maintain the order of the records:

awk '{
  if(!a[$1]){
    b[c++]=$1
  } 
  a[$1]+=$2
}
END{
  for(i=0;i<c;i++) 
    print b FS a
[b]}' file

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