I have a list of files eg.
page-1.htm page-2.htm page-32.htm
How do I use rename to be like this:
page-01.htm page-02.htm page-32.htm
I am new to this and having trouble understanding the examples online. I want to do something like the following where the ? is a variable character:
rename 's/page-?.htm$/page-0?.htm/' *
Advertisement
Answer
?
mean “any character”.
So, your page-1.htm
will be rename because it’s match with pattern page-?.htm
but page-32.htm
don’t
for your problem, you can use find | replace
method, like this:
find -name 'page_?.htm' | rename 's/page_/page_0/'
I know it’s doesn’t what you really want, but it’s temp solution