dimanche 1 mars 2015

How to print the the current date with filtered out MQTT stream?


I filter out the datum from the MQTT stream with



mosquitto_sub -d -t +/# 2>&1 | sed -u -n "/PUBLISH/{s|.*\('.*',\).*|\1$(date),|;N;s/\n//;p}"

this code works fine, however the date seems to reprint the same date/time over and over again, ie the date doesn't get updated.


A sample of the output from the above filter:



'm/gf/TMX6BP/075/d/SVlts',Sun Mar 1 21:19:11 UTC 2015,128,24792,24224 24224 837
'm/gf/TMX6BP/075/d/status',Sun Mar 1 21:19:11 UTC 2015,128,33000,169621,-33.836465,151.051189
'm/gf/MXE/065/d/SVlts',Sun Mar 1 21:19:11 UTC 2015,528,24627,28127 28127 977
'm/gf/TMX6BP/075/d/SVlts',Sun Mar 1 21:19:11 UTC 2015,129,24708,24626 24626 857
'm/gf/MXE/065/d/status',Sun Mar 1 21:19:11 UTC 2015,528,33000,6122,-33.836465,151.051189
'm/gf/TMX6BP/075/d/status',Sun Mar 1 21:19:11 UTC 2015,129,33000,169626,-33.836465,151.051189


Q: How can I readjust my code so that the date gets updated every time datum gets passed by my filter.



Aucun commentaire:

Enregistrer un commentaire