Last active
June 5, 2024 14:56
-
-
Save ochaloup/bd918d43e84087161b6ec6c5a5937b86 to your computer and use it in GitHub Desktop.
Binary format to decimal bytes format
This file contains 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
if [ "$1" == "-h" ] || [ $# -eq 0 ] || [ $# -gt 1 ]; then | |
echo "Expecting one parameter, a path to binary file, e.g. 'solana -um account -o /tmp/data.bin'" | |
echo "$0 /tmp/data.bin" | |
exit 0 | |
fi | |
FILE="$1" | |
decimal_array=($(od -v -An -t u1 < "$FILE")) | |
echo -n '['$(echo -n ${decimal_array[@]} | sed 's/ /,/g')']' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment