I have this command:
awk -F'\t' '$3 ~ "Aspergillus fumigatus" {print}' $krakenfile > Aspergillus_fumigatus_lines.txt
It is working very fine, It just extracts every line in the file $krakenfile that contain the word "Aspergillus fumigatus" in its third column.
Now, I want to introduce another file ($fungalnames) that contains multiple lines, every line contains names of species and I want to apply the command on every line of the new file.
I tried this:
while IFS= read -r specie_name
do
awk -F'\t' '$3 ~ "$specie_name" {print}' $krakenfile > "${specie_name}_lines.txt"
done < $fungalnames
Anyway, the output files are created (I had 8 species names in my $fungalnames file and there are 8 output files, every file is named to a line, but all the files are empty !!
I tried multiple times, and I changed syntaxes, but nothing is working.
I think I am escaping an important thing, can anyone help me please! Thank you in advance!