On 03/09/2026 22:10, Raymond Allen via GNU coreutils Bug Reports wrote:
Greetings,
Here is an example that illustrates the problem:
Run the command:
echo -n "BADCFEHG" | od -t x2z -A x --endian=little
The output is:
000000 4142 4344 4546 4748 >BADCFEHG<
000008
As expected, the input data has been interpreted as 16-bit data and
byte-swapped
in the hex output, however the ASCII representation to the right is not
byte-swapped.
I checked the documentation and its description of the 'z' type suffix
offers no clue
as to whether the byte-swapping applies to the output characters or not.
FYI, I am using od version 9.4, running under Ubuntu 24.04.
Regards,
Would you ever want the string printed in non linear order though?
Can you show a case where this is useful?
Much more useful to me would be to show the hex values in the appropriate order
aligned with the corresponding interpretation. E.g.:
$ echo -n "BADCFEHG" | od -td2 -tx2 --endian=little
0000000 16706 17220 17734 18248
4142 4344 4546 4748
This is more general to me, especially given there
isn't a printable character for every byte value.
If we were to group/swap the string bytes, then we'd need another
selector (Z?) to do it, but again I can't see the use case.
cheers,
Padraig