My file1.txt looks like this
ENST00000456328.2_1
ENST00000002596.6_3
ENST00000488147.1_2
ENST00000003302.8_2
and my file2.tsv looks like this
ENST00000456328.2_1 ENSG00000223972
ENST00000450305.2_1 ENSG00000223972
ENST00000488147.1_2 ENSG00000227232
ENST00000473358.1_1 ENSG00000243485
I would like to loop through the whole column and:
if column 1 in file1 == column 1 in file 2
print column 2 in file2 into a new txt file.
*file2 contains all the values of file1
to give the output.txt
ENSG00000223972
ENSG00000227232
May I know how to do this in R or linux? Thank you.