On Wed, Jan 23, 2019 at 4:10 PM Grant Edwards <grant.b.edwa...@gmail.com> wrote: > > On 2019-01-23, Alexander Kapshuk <alexander.kaps...@gmail.com> wrote: > > > > How about this one? > > > > echo '198.088.0.01 > > 198.088.062.01' | sed 's/\.0\([0-9][0-9]*\)/.\1/g' > > 198.88.0.1 > > 198.88.62.1 > > Also no. > > $ echo 198.088.0.001 | sed 's/\.0\([0-9][0-9]*\)/.\1/g' > 198.88.0.01 > > > -- > Grant Edwards grant.b.edwards Yow! Hello. Just walk > at along and try NOT to think > gmail.com about your INTESTINES being > almost FORTY YARDS LONG!! > >
This any better? :-) echo '198.088.0.01 198.088.062.01 198.088.0.001' | sed -r 's/\.0+([^.0]+)/.\1/g' 198.88.0.1 198.88.62.1 198.88.0.1