Skip to content

Instantly share code, notes, and snippets.

@ochaloup
Last active June 5, 2024 14:56
Show Gist options
  • Save ochaloup/bd918d43e84087161b6ec6c5a5937b86 to your computer and use it in GitHub Desktop.
Save ochaloup/bd918d43e84087161b6ec6c5a5937b86 to your computer and use it in GitHub Desktop.
Binary format to decimal bytes format
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