5

Check for the existence and add them from 2 different files

view full story
linux-howto

http://www.unix.com – Hi, I have two files file1: Code: ALEX DANY GARY TOM MARY HARRIS file2: Code: ALEX 3 ALEX 5 ALEX 0 ALEX 1 ALEX 0 DANY 2 DANY 3 DANY 0 DANY 0 DANY 1 GARY 20 GARY 25 GARY 3 GARY 5 GARY 0 TOM 8 TOM 7 TOM 0 TOM 5 TOM 2 TOM 1 MARY 0 MARY 0 MARY 8 MARY 12 MARY 2 MARY 1 HARRIS 5 HARRIS 6 HARRIS 12 HARRIS 18 HARRIS 13 HARRIS 20 LILY 12 LILY 13 LILY 5 LILY 8 LILY 16 What i am trying to do is for each entry in file 1 I need to count the values for the same entry in column 2 and add them up. output: Code: ALEX 9 DANY 6 GARY 53 TOM 23 MARY 23 HARRIS 74 Thanks, (HowTos)