Column matched in two files
I have two files with multiple columns separated by commas.
I want to search one column from the first file in the second file;
If there is a matching, will append that matched row to the first file. Let me show an example... (unique values in the search column)
First file
aa,reg1,bb,cc,dd,ff
xx,reg2,dfd,dfc,dfdas
cv,reg3,dfd,dfc,erwqe
df,xcv.df,cv,'',;l
I would like to search the second column of the first file with the fifth column of the second file.
Second file
111,334,77,888,reg7
adf,5435,7652,425,reg3
dfa,1,23,N,
adf,2,56,76,pop
The result should be
aa,reg1,bb,cc,dd,ff
xx,reg2,dfd,dfc,dfdas
cv,reg3,dfd,dfc,erwqe,adf,5435,7652,425
df,xcv.df,cv,'',;l
How can I do this please?
Thank you very much