My input file looks like this
12 3 5.122.281.413 172.31.15.220 3421 4133 2 2 1454 3421 4133 2 2 0
12 44036 214.215.52.146 90.123.245.211 2312 3911 4 4 521 2312 3911 4 4 1
14 504 6.254.324.219 192.61.27.120 4444 5611 7 5 1415 4444 5611 7 5 1
13 9 146.216.51.151 5.132.212.115 5432 6123 9 1 78 5432 6123 9 1 1
16 41228 96.201.221.214 5.132.212.115 3411 5120 3 3 1358 3411 5120 3 3 1
my aim is to convert these ip address to a decimal form using this formula
so if my ip address is 192.168.1.2
my result
192 x (256)^3 + 168 x (256)^2 + 1 x (256)^1 + 2 (256)^0 = ?
3221225472 + 11010048 + 256 + 2 = 3232235778
so for input file, my output file has to be
12 13 121.34.21.106 123.555.232.101 3212 4573 2 8 1497 4312 4573 2 8 1 2032276842 2100029541
12 59 102.212.234.12 96.201.221.215 3412 5557 9 7 1498 1212 5557 9 7 1 1725229580 1623842263
14 22 111.116.149.61 121.51.26.198 2122 4122 6 9 1498 344122 4122 6 9 0 1869911357 2033392326
13 10 214.328.274.31 122.81.25.110 2311 3632 4 7 1471 2311 3632 4 7 0 3611890207 2052135278
16 12 121.85.52.235 87.183.82.42 3311 3922 3 1 1495 3311 3922 3 1 1 2035627243 1471631914
Is there a sed or awk one liner that can do this:
I tried this:
sed 's/. 256^3\+\.256^2\+\.256\+\.\' input.txt> outfil.txt
Also if I do
sed 's/[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/XXX.XXX.XXX.XXX/g' ./ input.txt>output.txt
will this be a non integer value?