1 |
On Wed, Jan 23, 2019 at 5:20 AM Adam Carter <adamcarter3@×××××.com> wrote: |
2 |
>> |
3 |
>> > François-Xavier |
4 |
>> > |
5 |
>> > |
6 |
>> |
7 |
>> My bad, it should be: |
8 |
>> |
9 |
>> sed 's/0*\([0-9][0-9]*\)/\1/g' |
10 |
>> |
11 |
>> (tests are indeed needed!) |
12 |
> |
13 |
> |
14 |
> 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 no leading zeros in the first octet of the IP so that case does not need to be handled. |
15 |
> |
16 |
> Does the \1 refer to what's in the ()'s? So anything that one would wont to carry through should be inside the ()'s and anything that's outside is stripped, right? |
17 |
> |
18 |
> |
19 |
> |
20 |
|
21 |
Would something like to do the trick? |
22 |
echo 198.088.062.01 | sed 's/\.0/./g' |
23 |
198.88.62.1 |