combine 2 files with AWK based last colums

Posted by mohammad reshad on Stack Overflow See other posts from Stack Overflow or by mohammad reshad
Published on 2012-10-08T13:27:37Z Indexed on 2012/10/08 15:38 UTC
Read the original article Hit count: 212

Filed under:
|
|

i have two files

file1
-------------------------------
1      a      t      p      b
2      b      c      f      a
3      d      y      u      b
2      b      c      f      a
2      u      g      t      c
2      b      j      h      c

file2
--------------------------------
1   a   b
2   p   c
3   n   a
4   4   a

i want combine these 2 files based last columns (column 5 of file1 and column 3 of file2) using awk

result
----------------------------------------------
1      a      t      p     1   a   b
2      b      c      f     3   n   a
2      b      c      f     4   4   a
3      d      y      u     1   a   b
2      b      c      f     3   n   a
2      b      c      f     4   4   a
2      u      g      t     2   p   c
2      b      j      h     2   p   c

© Stack Overflow or respective owner

Related posts about awk

Related posts about combine