View previous topic :: View next topic |
Author |
Message |
Telexen Apprentice
Joined: 09 Oct 2005 Posts: 189
|
Posted: Fri Aug 17, 2007 12:08 am Post subject: Need help with grep pulling CPU temp from sensors |
|
|
Code: |
$ sensors
k8temp-pci-00c3
Adapter: PCI adapter
Core0 Temp:
+41 C
Core1 Temp:
+30 C
k8temp-pci-00cb
Adapter: PCI adapter
Core0 Temp:
+30 C
Core1 Temp:
+39 C
|
That's my output of "sensors" ... I'm trying to create a Superkaramba theme that pulls temperature info from it using 'grep' since the 'sensors' sensor for karamba doesn't seem to handle that output very well.
I can get the first from each sensor (Core0 from each) easily, but I'm not sure how to manipulate grep to select which match it comes up with and then if it's a good idea to use grep several times...
Here's what I've found to get the first core pretty easily. So is it ok to use grep twice like this? I think a better angle would be to use the second to specify "Core0" or "Core1", but I can't figure out how to tell it to take the next line when I use -A [n].
Code: | sensors | grep -m 1 'k8temp-pci-00c3' -A 3 | grep '+' | cut -b 15,16 |
*edit*
it is a 4 core system, BTW.
Last edited by Telexen on Fri Aug 17, 2007 12:36 am; edited 1 time in total |
|
Back to top |
|
|
didymos Advocate
Joined: 10 Oct 2005 Posts: 4798 Location: California
|
Posted: Fri Aug 17, 2007 12:24 am Post subject: |
|
|
Why is the label on a separate line from the temp in the first place? Normally, it's all one line. _________________ Thomas S. Howard |
|
Back to top |
|
|
Telexen Apprentice
Joined: 09 Oct 2005 Posts: 189
|
Posted: Fri Aug 17, 2007 12:36 am Post subject: |
|
|
Not sure myself ...would make it a lot easier though |
|
Back to top |
|
|
didymos Advocate
Joined: 10 Oct 2005 Posts: 4798 Location: California
|
Posted: Fri Aug 17, 2007 12:54 am Post subject: |
|
|
Check /etc/sensors.conf and find the section for your device. Just change the format so it's a single line. _________________ Thomas S. Howard |
|
Back to top |
|
|
Telexen Apprentice
Joined: 09 Oct 2005 Posts: 189
|
Posted: Fri Aug 17, 2007 1:10 am Post subject: |
|
|
Ok that should make it easier. I'll try that out later.
Thanks. |
|
Back to top |
|
|
|