I am trying to remove specific characters from a file in bash but am not getting the desired result.
bash
for file in /home/cmccabe/Desktop/NGS/API/test/*.vcf.gz; do mv -- "$file" "${file%%/*_variants_}.vcf.gz" done file name
TSVC_variants_IonXpress_004.vcf.gz desired resuult
IonXpress_004.vcf.gz current result (extention in filename repeats)
TSVC_variants_IonXpress_004.vcf.gz.vcf.gz I have tried to move the * to the end and to use /_variants_/ and the same results. Thank you :).
TSVC_variants_constant here?