Hello, On Wed, 23 Jan 2019, Adam Carter wrote: >> $ printf '0.1.2.3 01.2.3.4 1.2.3.0 1.2.000.3\n' | \ >> sed 's/0*\([[:digit:]]\+\)/\1/g' >> 0.1.2.3 1.2.3.4 1.2.3.0 1.2.0.3 > >So [[:digit:]] is another way of writing [0-9] and the + just means another >instance of the proceeding expression, right, so your and Francois >solutions are functionally the same, and all the following are the same >too, right?
Not quite. [[:digit:]]+ == [0-9][0-9]* Not too, that [:digit:] respects locale. Don't know where locale applies though. Probably Devanagari or such. I just made myself to use classes rather than char-ranges. See man 7 regex for more classes. HTH, -dnh -- "UNIX was not designed to stop people from doing stupid things, because that would also stop them from doing clever things." -- Doug Gwyn