bash - CentOS, Convert ipV6 short to long form -


i have started bash scripting , there small problem have solve go on:

i'm getting ipv6 address in format: 1080::8:800:200c:417a

now want convert short long ipv6 form like: 1080:0:0:0:8:800:200c:417a

is there regex expression or similar convert that?

i working on docker container runs on centos 8.3.

it isn't regex, 'something similar' , job: (tested python3.5.1)

>>> import ipaddress >>> x = '1080::8:800:200c:417a' >>> y = ipaddress.ip_address(x) >>> y.exploded '1080:0000:0000:0000:0008:0800:200c:417a' >>>  

reference: https://docs.python.org/3/library/ipaddress.html


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -