Hi,
I wish to build a csv file from the information in my MQTT server.
This is my command:
Code:
~> mosquitto_sub -h 192.168.xxx.yyy -t topic/sub1/sub2/sub3 -u myuser -P mypass > file.txt
This is fine but the output contains more data than I need:
Code:
{"electricitymeter":{"timestamp":"2024-03-22T07:44:58Z","energy":{"export":{"cumulative":0.000,"units":"kWh"}... truncated for brevity!
Can anyone suggest a
sed command that I can pipe through, that will remove all but two patterns:
pattern 1: "timestamp":"2024-03-22T07:44:58Z",
pattern 2: "unitrate":0.15190,
Note that "timestamp" & "unitrate" are unique and fixed but the values (between the colon ':' and comma ',' are variable.
Best regards, Martin