I want to compare 2 files, locus_file.txt is a very large file and atrr.txt is a small file. I want to match the first 2 columns of the first file to the second column of atrr.txt and print the attributes together.
locus_file.txt:large file
LOC_Os02g47020, LOC_Os03g57840,0.88725114
LOC_Os02g47020, LOC_Os07g36080,0.94455624
LOC_Os02g47020, LOC_Os03g02590,0.81881344
attr.txt: attribute file
blue LOC_Os02g47020
red LOC_Os02g40830
blue LOC_Os07g36080
yellow LOC_Os03g57840
red LOC_Os03g02590
Desired output:
LOC_Os02g47020, LOC_Os03g57840,0.88725114,blue, yellow
LOC_Os02g47020, LOC_Os07g36080,0.94455624,blue, blue
LOC_Os02g47020, LOC_Os03g02590,0.81881344,blue, red
Note that: for example, In the first line of desired output, the 4th column has the color of LOC_Os02g47020 from atrr.txt and the 5th column has the color of LOC_Os03g57840 from atrr.txt
red LOC_Os02g40830,
correct? Does it have,
at the end of line? – cuonglm May 11 '14 at 15:47