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
Instead of
sed -r -e 's/\d+/sprintf("%03d",$&)/e'
use
perl -pe 's/\d+/sprintf("%03d",$&)/ge'