Monday, 9 February 2015

loop with grep function topic






Hi Ubuntu users,

I struggle to define a loop taking name in a first file (Bureau/taxa, each line of the file is a species name) and retrieving the line with the corresponding name and the DNA sequence associated in a second file (Bureau/conc_5genes.fas). The file Bureau/conc_5genes.fas is as follows:

species1 ATTGTCTAT
species2 TTGCATATC
...

Here is the loop:

for line in Bureau/taxa ;
do
grep '$line' Bureau/conc_5genes.fas >> Bureau/moldata_hostrecords;
done

Thank you for your help!






No comments:

Post a Comment