Image history data in separate file for access please

I was thinking of using the image history data as a cheap (and not fool proof) cloud monitor. If one sees the number of stars in the latest image start to drop significantly, it would very likely (not 100 pct sure, but still) mean that clouds are rolling in.
I found the data now dispersed and mixed with AF number of stars detected in the sgp log file. I can get it out of the file and rule out AF stars data, but ok, if ever the format changes, the script will start working.
For people wanting to give it a try, here is the command line (in Linux system on Windows - not tested yet on Windows, only on OSX on the sg log file I transferred). It should be put in an infinite loop, and you have to make sure there is only one log file in the SGP log directory. It sounds an alarm (replace afplay with any sound playing tool on windows) when the number of stars in between the latest two images drops by 50pct. I would put 80pct in there for real life.
Ideally SGP could just implement this internally as a simple cloud monitor, and integrate it with the alarm system :wink:

grep -i closing -A 20 sg_logfile*.txt | grep -i contains | tail -2 | awk ‘{ print $8 }’ | tr ‘\n’ ’ ’ | awk ‘{ v= $2 / $1 ; print $1 " " $2 " " v }’ | awk ‘{ if (NF==2) print “First image, no action.” ;else if ($3 < 0.50) system (“afplay alarm.mp3”); else print “Still clear” }’

In the meantime, my solution is finished and working. It not only detects possible clouds, but also network issues, SGP hangs or crashes and/or PC reboots.

I have published it in a note on FB for those interested.