Re: [gentoo-user] OT scripting - strip zero if between period and digit

2019-01-22 Thread Alexander Kapshuk
On Wed, Jan 23, 2019 at 9:05 AM Paul Colquhoun wrote: > > On Wednesday, 23 January 2019 5:52:57 PM AEDT Alexander Kapshuk wrote: > > On Wed, Jan 23, 2019 at 5:20 AM Adam Carter wrote: > > >> > François-Xavier > > >> > > >> My bad, it should be: > > >> > > >> sed 's/0*\([0-9][0-9]*\)/\1/g' > > >>

Re: [gentoo-user] OT scripting - strip zero if between period and digit

2019-01-22 Thread Paul Colquhoun
On Wednesday, 23 January 2019 5:52:57 PM AEDT Alexander Kapshuk wrote: > On Wed, Jan 23, 2019 at 5:20 AM Adam Carter wrote: > >> > François-Xavier > >> > >> My bad, it should be: > >> > >> sed 's/0*\([0-9][0-9]*\)/\1/g' > >> > >> (tests are indeed needed!) > > > > Many thanks François. This is

Re: [gentoo-user] OT scripting - strip zero if between period and digit

2019-01-22 Thread Alexander Kapshuk
On Wed, Jan 23, 2019 at 5:20 AM Adam Carter wrote: >> >> > François-Xavier >> > >> > >> >> My bad, it should be: >> >> sed 's/0*\([0-9][0-9]*\)/\1/g' >> >> (tests are indeed needed!) > > > Many thanks François. This is almost right, but it is also stripping zeros > that follow a letter, and I onl

Re: [gentoo-user] OT scripting - strip zero if between period and digit

2019-01-22 Thread François-Xavier CARTON
Le 23/01/2019 à 04:19, Adam Carter a écrit : > François-Xavier > > My bad, it should be: sed 's/0*\([0-9][0-9]*\)/\1/g' (tests are indeed needed!) Many thanks François. This is almost right, but it is also stripping zeros that follow a letter, and I only want it t

Re: [gentoo-user] OT scripting - strip zero if between period and digit

2019-01-22 Thread Paul Colquhoun
On Wednesday, 23 January 2019 2:32:43 PM AEDT 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 > > Hi David - thanks for that. > > So [[:digit:]] is another way of writing [0-9] and th

Re: [gentoo-user] OT scripting - strip zero if between period and digit

2019-01-22 Thread Adam Carter
> > $ 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 > > > Hi David - thanks for that. So [[:digit:]] is another way of writing [0-9] and the + just means another instance of the proceeding expression, right, so your and F

Re: [gentoo-user] OT scripting - strip zero if between period and digit

2019-01-22 Thread Adam Carter
On Wed, Jan 23, 2019 at 12:34 AM Michael Orlitzky wrote: > On 1/21/19 9:55 PM, David Haller 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 > > > > There are actually more than four examples that it n

Re: [gentoo-user] OT scripting - strip zero if between period and digit

2019-01-22 Thread Adam Carter
> > > François-Xavier > > > > > > My bad, it should be: > > sed 's/0*\([0-9][0-9]*\)/\1/g' > > (tests are indeed needed!) > Many thanks François. This is almost right, but it is also stripping zeros that follow a letter, and I only want it to strip zeros that are proceeded by a period. There are n

Re: [gentoo-user] OT scripting - strip zero if between period and digit

2019-01-22 Thread Michael Orlitzky
On 1/21/19 9:55 PM, David Haller 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 There are actually more than four examples that it needs to work on. And more to the point, this is going to destroy any other num

[Solved] Re: [gentoo-user] Re: bash upgrading problem

2019-01-22 Thread Jacques Montier
Le lun. 21 janv. 2019 à 21:38, Nikos Chantziaras a écrit : > On 21/01/2019 20:25, Jacques Montier wrote: > > Le lun. 21 janv. 2019 à 19:04, Nikos Chantziaras > > a écrit : > > > > I can't see why "emerge -uv bash" would ever invoke sudo. So I'd say > > that you s

Re: [gentoo-user] OT scripting - strip zero if between period and digit

2019-01-22 Thread David Haller
Hello, On Mon, 21 Jan 2019, Michael Orlitzky wrote: >On 1/21/19 6:50 PM, Adam Carter wrote: >> I need to clean up a file which has IP addresses with leading zeros in >> some of the octets so I need to make, say, .09 into .9 >> >> How do i do that in sed/awk/whatever? > >The first thing you should