coreutils
coreutils copied to clipboard
printf: Alternate hex representation with 0 padding puts the padding at the incorrect place
When printing hex number, with 0 padding, the extra zeros go in between 0x and the digits. We put them at the beginning:
env printf "%#06x\n" 123
0x007b
$ ./coreutils-main printf "%#06x\n" 123
000x7b