I have input data:
foo 24 foobar 5 bar bar foo 125
and I\'d like to have output:
foo 024 foobar 005 bar bar foo 125
Add the max number of leading zeros first, then take this number of characters from the end:
echo 55 | sed -e 's:^:0000000:' -e 's:0\+\(.\{8\}\)$:\1:' 00000055