I am trying to rename some files using the bash command, but I do not know how to add an arithmetic expression / mathematical operation to a regular expression expression.
Input:
a000.png a001.png ...
Ouput:
a010.png a011.png ...
I am trying to add 10 to the names.
Some things I tried:
rename -n -e 's/a(\d+).png/a$1 + 10.png/' * rename -n -e 's/a(\d+).png/a{$1 + 10}.png/' * rename -n -e 's/a(\d+).png/a$($1 + 10).png/' *
Is there an easy way to do this?
. , sprintf, "%03d". , , , a, [a-zA-Z]* a. , * , (, *.png).
sprintf
"%03d"
a
[a-zA-Z]*
*
*.png
, , -n, .
-n
rename -v 's/([a-zA-Z]*)([0-9]*)/$1.sprintf("%03d",$2+10)/e' *