duplicate certain lines _A_ by emoken

1{h;d}
x
s/ /\n/g
:
s/0\(0*\)$/X\1/gm
t
s/$/@0123456789/gm
s/\(.\)\(X*\)@.*\(.\)\1.*/\3\2/gm
y/X/9/
/\b0\+\b\n\?/{s///;x;p;x}
x

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top