D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Help with a little code for conky

 

On 07/12/18 09:40, Pentiddy wrote:
Hi All,

As a little diversion I'm looking at presenting information from Aurorawatch API on conky.
Got somewhere but my programming skills now find me lacking...

So in .conkyrc file I have the following
${execi 300 grep "state" ~/.cache/conky-vision/aurora2.xml | grep -o "name=\"[^\"]*\"" | grep -o "\"[^\"]*\"" | grep -o "[^\"]*" | awk 'NR==1' | tr '[a-z]' '[A-Z]'}\

form the file aurora2.xml whose contents show

<aurorawatch>
  <current>
    <state name="green" value="0" color="#33ff33">No significant activity</state>
  </current>
  <previous>
    <state name="yellow" value="50" color="#ffff00">Minor geomagnetic activity</state>
  </previous>
  <station>SAMNET/LAN2. Lancaster, UK.</station>
  <updated>2018-12-07 08:45:32</updated>
</aurorawatch>

This displays "GREEN" (or whatever the status is...
I would simply like to display the last information on that line "No significant activity"
Any help with this would be gratefully received.
Thanks

Anthony

Pentiddy Logo. Pentiddy Woods / Pentiddy Woods newsletter

Attached files are likely to be open-document format (*.odt or *.ods).
Why? So as not to depend on one company for accessing my own data in future.
See:  https://www.documentliberation.org/
MS-Word may say 'damaged file' to discourage this but should open the attachment(s) anyway.

Pentiddy Natural Burials
Heartwood Creations
Pentiddy Community Woodland



That looks overly complicated to me .. leave it with me and I'll have a think with my sed/awk/RE-fu for later... assuming someone doesn't nail it before me!! :]

MJE

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
The Mailing List for the Devon & Cornwall LUG
https://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq