how can i compare the columns from different lines in awk

view story

http://stackoverflow.com – Suppose i have this file var1 300 var1 400 var3 600 Now how can i compare the $1(from line 1) == $1 (from line 2) basically i just want to add the columns if the name is equal Only with awk The output should br var1 700 var3 600 (HowTos)