Re: Loop on mysql output with bash

From: Boubaker Idir <boubaker.idir_at_gmail.com>
Date: Mon, 12 Mar 2018 10:41:48 -0700 (PDT)
Message-ID: <7359050c-a7b9-4216-b70c-7d45331a9176_at_googlegroups.com>


[Quoted] Hello Pitcher thank you for your answer. I have a database with the name "Mydatabase" with a table wifi, the table wifi has those elements: id, packetid, bssid,rssi. multiple id have the same packetid, and different bssid and rssi. I want to do a select from my database and to put it in a json file like this:

{"wlan": [{"mac": "78:54:2E:EC:75:96", "powrx": -52},{"mac": "16:2D:27:96:08:36", "powrx": -56},{"mac": "F8:D1:11:4C:28:EC", "powrx": -73},{"mac": "00:14:6C:41:37:8E", "powrx": -76},{"mac": "00:23:04:5C:73:9A", "powrx": -77},{"mac": "00:23:04:5C:73:90", "powrx": -79},{"mac": "00:23:04:5C:60:40", "powrx": -81}]}

[Quoted] [Quoted] I want this output in a json file for each packetid, the same result each time to send it via curl to an API, so I must have a loop for each packetid and each time the results goes to the json file. Thank you I hope I explained better Received on Mon Mar 12 2018 - 18:41:48 CET

Original text of this message