I seem to have a little bit of an issue with spaces when trying to use for loops and grep together. The whitespace is important because, for example, I'd like to match 'k117_19650 ', but not 'k117_196509 '. Help would be appreciated!
for i in 'k117_19650 ' 'k117_460555 ';do
grep -A1 $i final.contigs.fa >> gene.fa
done
-w
and you will be safe when match 'k117_19650 ', but not 'k117_196509 ' for example – Romeo Ninov Jan 07 '20 at 14:19