Gentoo Archives: gentoo-user

From: Adam Carter <adamcarter3@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] OT scripting - strip zero if between period and digit
Date: Wed, 23 Jan 2019 03:33:03
Message-Id: CAC=wYCGYH6rPZxSEh8JeNCrUkwqKNW05On7u4e=4UE4V+Yw_-Q@mail.gmail.com
In Reply to: Re: [gentoo-user] OT scripting - strip zero if between period and digit by David Haller
1 >
2 > $ printf '0.1.2.3 01.2.3.4 1.2.3.0 1.2.000.3\n' | \
3 > sed 's/0*\([[:digit:]]\+\)/\1/g'
4 > 0.1.2.3 1.2.3.4 1.2.3.0 1.2.0.3
5 >
6 >
7 >
8 Hi David - thanks for that.
9
10 So [[:digit:]] is another way of writing [0-9] and the + just means another
11 instance of the proceeding expression, right, so your and Francois
12 solutions are functionally the same, and all the following are the same
13 too, right?
14
15 [[:digit:]]+
16 [[:digit:]][[:digit:]]
17 [0-9]+
18 [0-9][0-9]

Replies

Subject Author
Re: [gentoo-user] OT scripting - strip zero if between period and digit Paul Colquhoun <paulcol@×××××××××××××××××.au>
Re: [gentoo-user] OT scripting - strip zero if between period and digit David Haller <gentoo@×××××××.de>