This option produces no spacing between bytes in a binary message:
paul@desktop:~$ mosquitto_sub -t out -F '%x' -v
3031320033340035
3031320033340035
I hoped this would work:
paul@desktop:~$ mosquitto_sub -t out -F '%3x'
30
30
but it truncates the message. What is a solution to get some separation between the bytes, e.g. 30 31 32 00 33 34 00 35?
BTW, I've read https://mosquitto.org/man/mosquitto_sub-1.html#outputformat and How to display binary MQTT data?.
This is not currently possible within mosquitto_sub, however it can be done with a sed command:
Having said that, the
precisionformat option is currently unused for hex payloads, so adding support formosquitto_sub -F %.4x ...seems like a good idea. That'll be in the next (long overdue) feature version.For example: