Suppose I have a reference list, say file1.txt, which contains:
a
b
c
d
and I have file2.txt, the data file as follows:
a 1 2 3
b 5 6 7
d 6 7 8
e 7 8 9
and output needed in output.txt:
a 1 2 3
b 5 6 7
d 6 7 8
I want to match IDs in file1.txt with first column of file2.txt and print the whole line (row from file2.txt) into output.txt
Also in perl :
Note:The above perl command will work provided the first file has unique ID’s