ipconfig610
asked on
bash MySQL result into array
I have a script that runs every 15 minutes which looks for phone calls in a database and groups them by the sourceTN counting calls. The query and result is below. My questions is I need to be able to store each row (sourceTN and Calls) into a temporary variable so I can crank it through and IF statement to see if a telephone number has a value greater then 10. Something like...
IF Calls > 10
THEN
# do some actions with the SourceTN
Query:
IF Calls > 10
THEN
# do some actions with the SourceTN
Query:
SELECT src as SourceTN, COUNT(src) as Calls FROM cdr GROUP BY src;"
+------------+-------+
| SourceTN | Calls |
+------------+-------+
| 2012680000 | 27 |
| 2016240000 | 1 |
| 2018160000 | 2 |
| 2018160000 | 5 |
| 2018160000 | 7 |
| 2018160000 | 9 |
| 2018160000 | 1 |
| 2018160000 | 4 |
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In case the output goes to a temporary file, you could parse the file and search for lines matching your 'clause' > 10 calls using awk for example.
If possible can you post (part of your) script?