Breaking down a long string and then converting hex to decimal

From another output, I have a long string:

00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000033B2E3C9FD0803CE8000000000000000000000000000000000000000000000D610B7305BB52FC30A0000000000000000000000000000000AF298D050E4395D69670B12B7F410000000000000000000000000000000000000000000000000000000000000000000000000000

which needs to be broken down into 64 character parts:

0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000033B2E3C9FD0803CE8000000
000000000000000000000000000000000000000D610B7305BB52FC30A0000000
000000000000000000000000AF298D050E4395D69670B12B7F41000000000000
0000000000000000000000000000000000000000000000000000000000000000

and then each line needs to be converted from hex to decimal with something like echo "obase=10; ibase=16; $hexNum" | bc

the hex part is easily solved. I suspect that an "awk" manipulation of the long string can break it down into 5 variable.. to which the above bc command can convert to decimal.



Read more here: https://stackoverflow.com/questions/67007960/breaking-down-a-long-string-and-then-converting-hex-to-decimal

Content Attribution

This content was originally published by Matt at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: