Find the common values

Hi,

I have two files with the below values.

file1

305231921      1.0       ben/Ben_Determination_Appeals
1348791394     2.0      ben/Ben_Determination_Appeals]
1305231921     1.0      ben/Cancel_Refund_Payment_JLRS
1348791394     2.0      ben/Cancel_Refund_Payment_JLRS
1305231921     1.0      ben/Cancel_Refund_PERS
1348791394     2.0      ben/Cancel_Refund_PERS

file2

Ben_Determination_Appeals[2.0]
Cancel_Refund_Payment_JLRS[2.0]
Cancel_Refund_PERS[2.0]

I want the result based on the values of 2nd file. Output should be

1348791394     2.0      ben/Ben_Determination_Appeals
1348791394     2.0      ben/Cancel_Refund_Payment_JLRS
1348791394     2.0      ben/Cancel_Refund_PERS 
awk 'NR==FNR{a[$1]++;next}
{split($3,b,"/")
s=b[2]"["$2"]"
if (a){print}}' file2 file1
1 Like

Thanks Pravin. It worked fine. If possible can you please explain the code and also can you let me know from which site i can start learning awk.