I already referred this post and post
I have my filenames like as shown below (1 set contains 3 related files). In my directory, I have 40 set of files (meaning 120 files). All the 40 sets have 3 files with same file extension
Set 1
Test_t5.version9.info.gz
Test_t5.version9.dose.vcf.gz.tbi
Test_t5.version9.dose.vcf.gz
Set 2
Test_t5.version12.info.gz
Test_t5.version12.dose.vcf.gz.tbi
Test_t5.version12.dose.vcf.gz
Only the version number in file changes across different sets.
Now, I would like to rename my files like as shown below
Set 1
Test_t5.version9.info.gz
Test_t5.version9.dose.vcf.gz.tbi
Test_t5.version9.dose.vcf.bgz #see the change here from `.gz to .bgz`
Set 2
Test_t5.version12.info.gz
Test_t5.version12.dose.vcf.gz.tbi
Test_t5.version12.dose.vcf.bgz #see the change here from `.gz to .bgz`
I tried the below but guess am making mistake while executing the command in the shell.
rename 's/dose.vcf.gz/dose.vcf.bgz/' Test_t5.version*.dose.vcf.gz
Basically modify the file extension for only one file in each of the set. You don't have to worry about Set 1
or Set 2
. That was for you to understand that how our data is grouped.
Can you help please?