awk "intelligently" paste two files together.

view story

http://www.unix.com – Hi everyone, I am trying to join two files together based on a field present in both files but not necessarily in the same order. File 1: 123 user1 245 user2 559 user3 File 2: 123 user1 246 user4 544 user2 Also, sometimes a user may not even be in both files. What I want awk to do is look at field 2 and, when it finds the user in both files, add up the numbers in column one and print the username and the total. So desired output 246 user1 789 user2 I have seen a couple of similar examples here on the unix forums. However, nothing is exactly what I am trying to do and I just don't und (HowTos)