Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Need help with grep pulling CPU temp from sensors
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Telexen
Apprentice
Apprentice


Joined: 09 Oct 2005
Posts: 189

PostPosted: Fri Aug 17, 2007 12:08 am    Post subject: Need help with grep pulling CPU temp from sensors Reply with quote

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
View user's profile Send private message
didymos
Advocate
Advocate


Joined: 10 Oct 2005
Posts: 4798
Location: California

PostPosted: Fri Aug 17, 2007 12:24 am    Post subject: Reply with quote

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
View user's profile Send private message
Telexen
Apprentice
Apprentice


Joined: 09 Oct 2005
Posts: 189

PostPosted: Fri Aug 17, 2007 12:36 am    Post subject: Reply with quote

Not sure myself ...would make it a lot easier though
Back to top
View user's profile Send private message
didymos
Advocate
Advocate


Joined: 10 Oct 2005
Posts: 4798
Location: California

PostPosted: Fri Aug 17, 2007 12:54 am    Post subject: Reply with quote

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
View user's profile Send private message
Telexen
Apprentice
Apprentice


Joined: 09 Oct 2005
Posts: 189

PostPosted: Fri Aug 17, 2007 1:10 am    Post subject: Reply with quote

Ok that should make it easier. I'll try that out later.

Thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum