$ gem install ipaddress
$ ruby -r ipaddress -e "puts IPAddress('2404:6800:400a:804::2004').data.unpack('C16').join('.')"
36.4.104.0.64.10.8.4.0.0.0.0.0.0.32.4
Last active
February 8, 2016 04:06
-
-
Save codeout/42c8090944d55e2f64a7 to your computer and use it in GitHub Desktop.
ipv6 to decimal
mapのところを短く修正
ruby -r ipaddr -e "p IPAddr.new('2404:6800:400a:804::2004').to_string.gsub(':','').scan(/.{2}/).map(&:hex).join('.')"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
gem要らない版です
ruby -r ipaddr -e "p IPAddr.new('2404:6800:400a:804::2004').to_string.gsub(':','').scan(/.{2}/).map{|x| x.hex }.join('.')"