regex - How to match two files and filter a third for matched values by column? -


i appreciate input on following:

i want match 2 files there ids (first column) , filter third file columns ids match.

i have 3 files (see below). match file1$1 ids in file2. of ids equal between 2 files, filter file3 columns. file3 columns ordered row1 of file1. difference id names not denoted column names of file3. know has same ordering.

file1:

id  x  y id1 x1 y1 id2 x2 y2  id3 x3 y3 

file2:

id1 id3 

file3 (columns in similar order rows of file1 - without actual ids)

z 1 2 3 w 1 2 3 v 1 2 3 

output:

z 1 3 w 1 3 v 1 3 

how should go about?

there's no need sed, awk, paste or join.

cut -d' ' -f`grep -nffile2 file1|cut -d: -f1|tr '\n' ,`1 file3 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -