Compare 1st column from 2 file and if match print line from 1st file and append column 7 from 2nd

hi

I have 2 file with more than 10 columns for both

1st file

apple,0,0,0......
orange,1,2,3.....
mango,2,4,5.....

2nd file

apple,2,3,4,5,6,7...
orange,2,3,4,5,6,8...
watermerlon,2,3,4,5,6,abc...
mango,5,6,7,4,6,def....

I want to match the first column of both file and if it matches, print the whole line from 1st file and append 7th column from 2nd file to it for everyline so it becomes like this

apple,0,0,0......7
orange,1,2,3.....8
mango,2,4,5.....def

Any help would be much appreciated

Now, this problem has been solved umpteen times in these forums. Try searching relevant threads and adapting the given solutions. You may start with the links at this page's lower left under "More UNIX and Linux Forum Topics You Might Find Helpful".

1 Like