Last active
April 7, 2017 05:07
-
-
Save flashvoid/0965307f6f63612e363521c46229bbe6 to your computer and use it in GitHub Desktop.
format hex string using awk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
awk '{ | |
split($0, chars, ""); | |
for (i=1; i<=length($0); i++) { | |
if (flagInLine == 0) { printf ("%-5d", i/32); flagInLine=1 } | |
printf("%s%s ", chars[i], chars[i+1]); | |
if ((i+1) % 32 == 0) { flagInLine=0; printf "\n"} | |
i++ | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment