You are not logged in.
Is it possible to find text in a file with grep maybe
to do this?
#${if_up enp3s0} ############################
${if_existing grep "keyword" /home/myfile.txt}
${else}
do this
${endif}
Last edited by MrEd (2019-08-06 16:49:15)
MSI B85M-G43 * Dualcore 3.3GHz *-12GB ram * GT740 4GB video * Logitech USB-Marble Mouse=Trackball * System - ArchLinux-Antergos, KDE Plasma Desktop - Conky 1.10
Offline
This works to a point.
If you have an existing image, try this.
${if_existing /home/major/.conky/My_conky/edweather/pcloudy.gif}
Now: ${color 00FF00}${exec cat /home/major/.conky/My_conky/edweather/rssweather.txt | awk -F "[><]" '/<description>/{print $3}' | awk 'NR==3{print $description}' | fold -w50 -s}${color}
${else}
Tonight:${color 00FF00}${exec cat /home/major/.conky/My_conky/edweather/rssweather.txt | awk -F "[><]" '/<Tonight>/{print $3}' | awk 'NR==3{print $description}' | fold -w50 -s}${color}
${endif}
The problem here is under $else
All that happens is it prints "Tonight:" in the conky window and does not complete the rest of the code as it does under ${if_existing blah blah}
To test, just change the image name.
Last edited by MrEd (2019-07-25 03:03:19)
MSI B85M-G43 * Dualcore 3.3GHz *-12GB ram * GT740 4GB video * Logitech USB-Marble Mouse=Trackball * System - ArchLinux-Antergos, KDE Plasma Desktop - Conky 1.10
Offline
DISREGARD last post, I had something named wrong...duh me
I was trying a working example thing.
First post still stands at this point.
Thanks
Last edited by MrEd (2019-07-25 03:07:17)
MSI B85M-G43 * Dualcore 3.3GHz *-12GB ram * GT740 4GB video * Logitech USB-Marble Mouse=Trackball * System - ArchLinux-Antergos, KDE Plasma Desktop - Conky 1.10
Offline
First post still stands at this point.
Is it possible to find text in a file with grep maybe
to do this?#${if_up enp3s0} ############################
${if_existing grep "keyword" /home/myfile.txt}
The answer is in conky's documentation; under "Conky Objects" it says:
if_existing file (string)
if FILE exists, display everything between if_existing and the matching $endif. The optional second parameter checks for FILE containing the specified string and prints everything between $if_existing and the matching $endif.
- in other words, this should work (not tested):
${if_existing /home/myfile.txt "keyword"}
BL quote proposals to this thread please.
how to ask smart questions | my repos / my repos | my blog
Offline
AH, Thankyou!
I was having a hard time deciphering what I needed to do.
MSI B85M-G43 * Dualcore 3.3GHz *-12GB ram * GT740 4GB video * Logitech USB-Marble Mouse=Trackball * System - ArchLinux-Antergos, KDE Plasma Desktop - Conky 1.10
Offline