bash - Automate bgzip and tabix commands -


i have large amount of files extension .vcf.

for each of files want apply these commands:

bgzip -c file.vcf > file.vcf.gz tabix -p vcf file.vcf.gz 

i have been able automate first line, when comes second i'm not sure how proceed.

for in $(ls); gzip -c $i  > "${i}.gz"; done 

the second lines seems not working way:

tabix -p vcf *.vcf.gz 

why don't this?

for in *; gzip -c "$i"  > "${i}.gz"; tabix -p vcf "${i}.gz"; done 

notice proper quoting of first $i , avoiding ls.


Comments