Gentoo Archives: gentoo-user

From: Alexander Kapshuk <alexander.kapshuk@×××××.com>
To: Gentoo mailing list <gentoo-user@l.g.o>
Subject: Re: [gentoo-user] Re: OT scripting - strip zero if between period and digit
Date: Wed, 23 Jan 2019 18:56:06
Message-Id: CAJ1xhMUkuZZ1bCLot0T1w-3D27W+brOpWxN9ik6a=ichA7uBWg@mail.gmail.com
In Reply to: [gentoo-user] Re: OT scripting - strip zero if between period and digit by Grant Edwards
1 On Wed, Jan 23, 2019 at 4:10 PM Grant Edwards <grant.b.edwards@×××××.com> wrote:
2 >
3 > On 2019-01-23, Alexander Kapshuk <alexander.kapshuk@×××××.com> wrote:
4 > >
5 > > How about this one?
6 > >
7 > > echo '198.088.0.01
8 > > 198.088.062.01' | sed 's/\.0\([0-9][0-9]*\)/.\1/g'
9 > > 198.88.0.1
10 > > 198.88.62.1
11 >
12 > Also no.
13 >
14 > $ echo 198.088.0.001 | sed 's/\.0\([0-9][0-9]*\)/.\1/g'
15 > 198.88.0.01
16 >
17 >
18 > --
19 > Grant Edwards grant.b.edwards Yow! Hello. Just walk
20 > at along and try NOT to think
21 > gmail.com about your INTESTINES being
22 > almost FORTY YARDS LONG!!
23 >
24 >
25
26 This any better? :-)
27
28 echo '198.088.0.01
29 198.088.062.01
30 198.088.0.001' | sed -r 's/\.0+([^.0]+)/.\1/g'
31 198.88.0.1
32 198.88.62.1
33 198.88.0.1

Replies

Subject Author
[gentoo-user] Re: OT scripting - strip zero if between period and digit Grant Edwards <grant.b.edwards@×××××.com>