Entering edit mode
5.0 years ago
lessismore ★ 1.3k
i have a list of of files,
TMCS09g1008676.gene_ancestors.txt TMCS09g1008677.gene_ancestors.txt TMCS09g1008677.gene_ancestors.txt TMCS09g1008679.gene_ancestors.txt TMCS09g1008680.gene_ancestors.txt TMCS09g100868.gene_ancestors.txt
what i want to do is to search for that specific ID in this files in order to filter them. Should be a simple e.g.
grep TMCS09g1008676 TMCS09g1008676.gene_ancestors.txt, etc..
but i want to automatize all. i tried creating a list and then iterating e.g.
echo TMCS09g1008676.gene_ancestors.txt | cut d '.' -f1 | grep - TMCS09g1008676.gene_ancestors.txt but then
grep cannot read from its standard input.
any help would be highly appreciated.
my thought exactly.
however, perhaps you'll need to be a bit more strict with grep , as for example TMCS09g100868 might also return TMCS09g1008680. This of course depends also on the content of the files . If there is no confusion possible then WouterDeCoster answer will do perfectly.
grep -wwould be even better