I have a text file that is a list of OTU names in the first column, with the occurrence in each treatment in the following columns (totaling 34 columns). I put a sample of the table below. There are ~3000 OTUs total in this file (therefore, ~3000 rows).
CM2_9 0 0 0
AF141_14 22 25 23
AF171_13 13 0 0
LIPB162_1 0 0 0
I have a separate text file with all the OTU names of interest (~500 OTUs), which looks something like this:
WSF3_2
WSF1_2
AF172_15
IO2_57
Is there a simple way to retrieve just the rows in my table that match up to the OTUs of interest? I want, as output, a new table with just the rows of my OTUs of interest. Help please! I'm working in PUTTY (linux). Also, does anything need to be changed to a comma delimited file? Both files are tab delimited as a .txt file.
Take a look at
join
command in unix if you do not want to use external programs.Could you try the following solution:
test2.txt contains all the OTU names of interest (~500 OTUs) and test1.txt is complete OTU file (~3000 OTUs)
Input:
output: