1

arrange rows of one file same as rows in second

view story
linux-howto

http://stackoverflow.com – I have two files and i want to arrange rows of 2nd file in the same order of rows in 1st file. where column no 2 and 5 of 2nd files have same values as 1st file only the difference is their order is different. considering that complete rows should rearrange not only 2nd and 3rd columns . please suggest. $ cat file1 FEX MRU MOV FTL MOY $ cat file2 1/24/2013,MOV,144523,1/25/2013,MOV,1445231 1/24/2013,MOY,298792,1/25/2013,MOY,2987921 1/24/2013,FEX,628037,1/25/2013,FEX,6280371 1/24/2013,MRU,146084,1/25/2013,MRU,1460841 1/24/2013,FTL,454709,1/25/2013,FTL,4547091 Required output: 1/24/2013,FEX,6 (HowTos)