Gentoo Archives: gentoo-user

From: Kai Peter <kp@×××××××××××××××.org>
To: 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:00:43
Message-Id: a70dc33ca442d38f50706b40a627aac0@lists.gentoo.org
In Reply to: Re: [gentoo-user] Re: OT scripting - strip zero if between period and digit by Neil Bothwick
1 On 2019-01-23 18:26, Neil Bothwick wrote:
2 > On Wed, 23 Jan 2019 14:09:45 -0000 (UTC), Grant Edwards wrote:
3 >
4 >> > How about this one?
5 >> >
6 >> > echo '198.088.0.01
7 >> > 198.088.062.01' | sed 's/\.0\([0-9][0-9]*\)/.\1/g'
8 >> > 198.88.0.1
9 >> > 198.88.62.1
10 >>
11 >> Also no.
12 >>
13 >> $ echo 198.088.0.001 | sed 's/\.0\([0-9][0-9]*\)/.\1/g'
14 >> 198.88.0.01
15 >
16 > This is like playing Whack-a-Mole with sed ;-)
17
18 That's the fun ;-)
19
20 I think the truth is in the middle between a twelve-pages-script and a
21 one-liner. Split it, 'sed' it, check result, correct result if required,
22 combine it.
23
24 --
25 Sent with eQmail-1.11 beta - a fork of djb's famous qmail