I have this sed script that I am working on to delete the whole line in my OTU table when the species listed in a text file are found in my OTU table.
The script that I have right now and that doesn't work is below, but I can't make it work. Anyway, if you could please help me ASAP it would be very appreciated.
(read each line, search for it in my table and delete line, infile)
for i in $(cat /my/path/species.txt); do
sed -i '/"$i"/d' /my/path/ITS.OTU.table.tsv
done
thanks so much
'/'"$i"'/d'
but it is error prone in so many ways and in-efficient as well... not able to find exact duplicate of this question, but this one is close... https://unix.stackexchange.com/questions/398142/common-lines-between-two-files needs tweaking to delete, for ex:grep -vFf file1 file2
etc – Sundeep Oct 27 '17 at 14:23species.txt
file; ii)_ an exampleITS.OTU.table.tsv
and iii) the output you are expecting from those two example input files. We can't help you parse data that you don't show. For example, should we expectd. melanogaster
,Drosophila melanogaster
,dmel
,fly
? Will they always be one word or two? Will they appear in exactly the same way in both files? Can there be more than one per line? That said, the answer will almost certainly be what Sundeep suggested above. – terdon Oct 27 '17 at 14:25the text file is like this: Postia leucomallella Candida boidinii Diederichomyces cladoniicola
mostly two words sometimes more they will appear exactly the same way in both files never more than once per line or in the table file at all.
– Émilie Tremblay Oct 27 '17 at 14:31s__Mastigobasidium intermedium
in the OTU file but suggest that you would haveMastigobasidium intermedium
in the species file. That isn't identical. That's why we need to see an actual example. – terdon Oct 27 '17 at 15:08