Thanks a lot for the comment. Actually my vcf file contains SNPs called from transcriptomes. So, the #CHROM field contains a bunch of different "genes" around 26000. From these I want to extract according to #CHROM around 5000. This is why I asked if it is possible to be done by providing a list as a txt file with the desirable #CHROM names. This is how my prefixes in the #CHROM field look like. Moreover the headers do not have constant numbers but random.
TRINITY_DN6643_c0_g2