brndnmtthws / conky

Light-weight system monitor for X, Wayland (sort of), and other things, too
https://conky.cc
GNU General Public License v3.0
7.17k stars 615 forks source link

Grep options limited due to new syntax #211

Closed GarlandKey closed 6 years ago

GarlandKey commented 8 years ago

Synopsis Users are no longer able to use grep character classes or bracket expressions ( e.g. [[:space:]] ) using the new syntax.

Error Message Syntax error (~/.conkyrc:147: nesting of [[...]] is deprecated near '[') while reading config file.

References man grep https://www.gnu.org/software/grep/manual/grep.html

chepioq commented 8 years ago

For test can you give an example of syntax (or line) that don't work ?

chepioq commented 8 years ago

For test I make a little conky with that line : ${exec cat /home/dominique/.conkyrc/test.txt | grep [[:alpha:]]}

and that don't work, I think because [[...]] is a setting in conky 1.10

But with this line : ${exec cat /home/dominique/.conkyrc/test.txt | grep [[:alpha:]]}

That work , I just escape the double bracket with double \ : [[...]]

GarlandKey commented 8 years ago

Thanks, @chepioq - I'll give your solution a go. Will report back.

The line that I want to use is ${exec nvidia-smi -q -g 0 2>&1 | grep -A 2 -i '^[[:space:]]}\{4\}Clocks$' | grep -i Graphics | tail -1 | awk '{printf "% 5d%s", $3, $4}'}

GarlandKey commented 8 years ago

I think the above solution from @chepioq may have worked. I've got a new error from the line that I need to resolve before I can be sure.

GarlandKey commented 8 years ago

The new error that I'm receiving is sh: -c: line 0: unexpected EOF while looking for matching'' sh: -c: line 1: syntax error: unexpected end of file`

The line that I'm using is: ${exec nvidia-smi -q -g 0 2>&1 | grep -A 2 -i '^\[\[:space:\]\]}\{4\}Clocks$' | grep -i Graphics | tail -1 | awk '{printf "% 5d%s", $3, $4}'}

It's breaking here \[\[:space:\]\]}

chepioq commented 8 years ago

Try this : ${exec nvidia-smi -q -g 0 2>&1 | grep -A 2 -i '^[[:space:]]{4}Clocks$' | grep -i Graphics | tail -1 | awk '{printf "% 5d%s", $3, $4}'} You have a } after the last bracket ] ,which is useless.

chepioq commented 8 years ago

Just one question: What do you want to see ? If you want the current frequency clock, you can use nvidia-settings instead of nvidia-smi e.g. : nvidia-settings -q GPUCurrentClockFreqs -t

Return on my laptop: [dominique@host-192-168-1-2 ~]$ nvidia-settings -q GPUCurrentClockFreqs -t 475,896 [dominique@host-192-168-1-2 ~]$ Or [dominique@host-192-168-1-2 ~]$ nvidia-settings -q GPUCurrentClockFreqsString -t nvclock=475, nvclockmin=475, nvclockmax=475, nvclockeditable=0, memclock=896, memclockmin=900, memclockmax=900, memclockeditable=0, memTransferRate=1792, memTransferRatemin=1800, memTransferRatemax=1800, memTransferRateeditable=0, processorclock=950, processorclockmin=950, processorclockmax=950, processorclockeditable=0 [dominique@host-192-168-1-2 ~]$

GarlandKey commented 8 years ago

@chepioq That's correct - I was trying to pull the clock frequency. Thanks for sharing this solution - it's much easier to implement and read.

lasers commented 6 years ago

Issue solved by a kind and helpful person. Many thanks.