Looping over several files in bash

I have a bash script:

I am wondering how I can change this script to loop over a bunch of .vcf files and give output .txt with the name of corresponding .vcf

I tried changes done in similar script in Changing this code in a way to work for my files but I just messed everything up

Error means that quotations are missing. I am not going to review this chunk but at first glance check

printf 'TumorAltAlleleCount\tTumorAltAlleleFrequency\t'\n'


There are three quotation marks so one is not matched. I suggest you develop code within a good IDE that will help you debug. Please google around for potential solutions. I personally do R and Shell scripting in RStudio. It differently colors quoted and unquoted code so you immediately see if you missed a closing quotation somewhere.

If we save the script pasted in the main post as a sh file and we have some .vcf files in a folder, by this line we can iterate over vcf files to extract what mentioned in the script returning .txt output by the name of corresponding vcf

for file in *.vcf ; do bash indel_vcf_parasing.sh \$file ; done