Another method, with a string of DNA128533_mutect2_filtered.vcf.gz and extract the id of DNA128533 ,
DNA128533_mutect2_filtered.vcf.gz
DNA128533
You can also work with awk to find the same answer.
awk
s=DNA128533_mutect2_filtered.vcf.gz id=$( echo $s | awk -F_ '{print$1}' ) echo $id