sort file1 > file1.sorted sort file2 | join -1 10 -2 1 file1.sorted - | tee file3 #### $ echo "SimpsonH","Homer","Simpson","NULL","648","0","218 555","Nuclear Control","Nuclear Operator","111" > file1 $ echo "111","BurnsM" > file2 $ join -t, -1 10 -2 1 file1 file2 111,SimpsonH,Homer,Simpson,NULL,648,0,218 555,Nuclear Control,Nuclear Operator,BurnsM