I have the files with two numbers in the middle of each file:
FileName_46_01.wav
FileName_6_15.wav
FileName_3_7.wav
FileName_15_22.wav
and so on.
I need to rename files with shell script to add the leading zeros if it's needed:
FileName_46_01.wav
FileName_06_15.wav
FileName_03_07.wav
FileName_15_22.wav
Like this, using Perl's rename
command:
rename -n 's/\d+/sprintf "%.2d", $&/ge' ./*.wav
Remove -n
if happy with the output (dry-run mode).