I am passing a filename into my bash script and cleaning the name using sed. A few sample files would be:
Test 01.txt Test v2 01.txt
I would
This might work for you (GNU sed):
sed -r 's/[0-9]+/$(printf "%03d" &)/g;s/.*/echo "&"/e' file Test 001.txt Test v002 001.txt