I have diff output of two files with one character per line. Sometimes the output characters on "different" lines look the same in my terminal. I'd like to pipe the diff output through a function that can add the byte values (or possibly even the unicode code points) to the output so that I can see what the actual byte differences are.
I'm having trouble figuring out how to get the byte values of characters in Bash. Is there a way to do this? I see all sorts of answers about going the other direction, but I want to go from character to byte value.
You can use od
to show various representations of characters, including named ASCII (od -t a
) or hexadecimal (od -t x1
).