But be aware you will run into an issue with IPs greater than "7fff:ffff:ffff:ffff" as bash uses signed 64-bit integers. The highest order bit is a sign bit and so the integer representation of these values will be a negative number:
Last edited by Chubler_XL; 01-29-2018 at 07:35 PM..
Your question is a bit difficult to understand and answer as you're talking IPv6 and hexadecimal, but you're showing numbers and samples that don't comply.
- IPv6 uses 128 bit addresses, split into 8 subparts of 16bit each, represented in what is known as "colon-hexadecimal".
- depending on where you come from, a billion is 1E9 or 1E12, respectively. A hex number consisting of 16 sequential "F"s (equ. 4 subparts) is roughly 1,8E19, so way beyond that.
- in hexadecimal, "FFFF" would be the last representable number in four digits, not "each part max number is 9999". So the difference between 0x10000 and 0x95 would be 0xFF6B (65387), leading to quite unwieldy an output file.
Considering these implications, Chubler_XL's proposal handles the situation of non-IPv6 perfectly well:
Dear all,
I am trying to write c-program to read the following file containing hexadecimal values (snippet of big data file).
I want to combine two hexadecimal values together like A0A03E01 and then would like to have the binary equivalent to perform further test on it. Unfortunately, it failed... (16 Replies)
How can I convert hexadecimal values to Binary from the second field to the end
Input:
WS-2 23 345 235
DT-3 45 4A3 000
pp-2 76 300 E4
Output:
WS-2 100011 1101000101 1000110101
DT-3 1000101 10010100011 000
pp-2 1110110 1100000000 11100100 (16 Replies)
Hi Guys,
Is it possible to convert the hexadecimal to Binary by unix command.....I could not figure out....
If I need to convert AF6D to binary...what could be the way to do?
Thanks in advance!!
---------- Post updated at 02:57 AM ---------- Previous update was at 02:42 AM ----------
I... (6 Replies)
Hi there !
I have text files with some nonsense characters in it, so different text editors put different nonsense symbols, and, worse, the application that should be able to read these files doesn't.
With xxd, the nonsense characters show as "efbfbd", while they should be "c2a7" (the... (2 Replies)
Let's suppose i have a hexadecimal array with 16 cells.for example
b3e2d5f636111780
i want to convert it to an array of ascii characters(in C) so that
i can reduce total size of the file i want to put it in.
But i am afraid i have not fully understand the difference between ascii
and hex(i... (3 Replies)
Hi all,
I have a small script to convert my HexaDecimal Input to Decimal as output.
#!/bin/ksh
hd=00208060
dec=`printf %d $hd`
echo $dec
Output of the above program:
printf: 00208060 not completely converted
16
But my expected output is "2130016".
How can i acheive this.
I... (2 Replies)
hello every one this is my first post ... well i'm new to linux ....
i've been enjoying shell scripting tutorials and i'm new to writting scripts
i want to write a script that creates a directory tree named in hexadecimal but i'm stuck at the hexadecimal part ... here is my code (incase i... (2 Replies)