I type mosquitto_sub -d -t +/# from the Ubuntu terminal to access the MQTT stream.
However I would like to see only a specific set of data from the MQTT stream. I've added | grep -v PING so everything still be printed except for lines with PING in them but that didn't work.
I've tried | grep -A1 PUBLISH so I can see lines from the MQTT with PUBLISH in them, nothing changed: I just get the whole MQTT stream nothing gets filtered out.
How can I see the certain thing that I want to see from an MQTT stream? Alternatively; how can I filter certain things out of the MQTT stream or how can I extract data from the MQTT stream?
My input from the ubuntu terminal is as follows $ mosquitto_sub -d -t +/# and I've tried $ mosquitto_sub -d -t +/# | grep -v PING and $ mosquitto_sub -d -t +/# | grep -A1 PUBLISH but it just streams everything, doesn't grep anything. The output is as follows:
ed@agharta:~$ mosquitto_sub -d -t +/#
Received CONNACK
Received SUBACK
Subscribed (mid: 1): 0
Sending PINGREQ
Received PINGRESP
Sending PINGREQ
Received PINGRESP
Sending PINGREQ
Received PINGRESP
Sending PINGREQ
Received PINGRESP
Sending PINGREQ
Received PINGRESP
Sending PINGREQ
Received PINGRESP
Sending PINGREQ
Received PINGRESP
Sending PINGREQ
Received PINGRESP
Sending PINGREQ
Received PINGRESP
Sending PINGREQ
Received PINGRESP
Sending PINGREQ
Received PINGRESP
Sending PINGREQ
Received PINGRESP
Sending PINGREQ
Received PINGRESP
Received PUBLISH (d0, q0, r0, m0, 'm/jsyd/TEST/001/d/status', ... (34 bytes))
Sending PINGREQ
Received PINGRESP
Received PUBLISH (d0, q0, r0, m0, 'm/jsyd/TEST/001/d/SVlts', ... (28 bytes))
Sending PINGREQ
Received PINGRESP
For example how can I only see the PUBLISH from the live stream and not the PINGs?