IP Address Converter

后端 未结 7 1090
臣服心动
臣服心动 2020-12-29 11:17

There is IP address: 66.102.13.19, and from this address as that received this address

http://1113984275

But how? And how I can make this

7条回答
  •  半阙折子戏
    2020-12-29 11:42

    I think there's a simpler solution that also handles an arbitrary number of octets with no references to fixed offsets etc.

    echo 66.102.13.19 |
        tr . '\n' |
        while read octet; do
            printf "%.08d" $(echo "obase=2;$octet" | bc)
        done |
        echo $((2#$(cat)))
    

    output: 1113984275

提交回复
热议问题