bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Loop on mysql output with bash


From: Boubaker Idir
Subject: Loop on mysql output with bash
Date: Mon, 12 Mar 2018 09:43:49 -0700 (PDT)
User-agent: G2/1.0

Hello everybody, I need to do a loop on my mysql output (packetid) and put it 
everytime on the second SELECT command, to have a result for each packetid and 
put it everytime on text file. can you help me please? Thank you so much


#!/bin/bash
array=$(mysql -u root -pMyPassword -s -N <<QUERY_INPUT
use myDatabase;
SELECT packetid FROM wifi;
QUERY_INPUT
);

echo "address@hidden";

for i in "address@hidden" do

variable=$(mysql -u root -pMyPassword -s -N <<QUERY_INPUT
use myDatabase;
SELECT CONCAT("{""wlan"": 
[",GROUP_CONCAT(JSON_OBJECT("mac",bssid,"powrx",rssi)), "]}") FROM wifi WHERE 
packetid=$i;
QUERY_INPUT
);

echo $variable>text2.txt;
done 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]