RosettaCodeData/Task/Increment-a-numerical-string/Sed/increment-a-numerical-strin...

13 lines
163 B
Sed

s/^.*$/&:/
:bubble
s/^:/1/
/.:/ {
h
s/^.*\(.\):.*$/\1/
y/0123456789/123456789:/
s/:/:0/
G
s/\(.*\)\n\(.*\).:\(.*\)$/\2\1\3/
b bubble
}