D&C GLug - Home Page

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

[LUG] sed

 

Sorry for the semi-silly question- I really should learn sed properly.

lm_sensors prints lines like this:
fan1:     5273 RPM  (min =    0 RPM, div = 8)
fan2:        0 RPM  (min =    0 RPM, div = 8)
fan3:        0 RPM  (min =    0 RPM, div = 2)
M/B Temp:    +27C  (low  =   +15C, high =   +40C)   sensor = thermistor
CPU Temp:    +34C  (low  =   +15C, high =   +45C)   sensor = thermistor
Temp3:       +54C  (low  =    -1C, high =    -1C)   sensor = thermistor

What I want is the fan1 speed (just "5273") and all 3 temperatures- as 
"27" (without the + or C).

I will be grepping out the line I want, so sed only has to deal with 
single lines.

I've been using cut for things like this before, but it's not really up 
to the job anymore.

Thanks in advance
Simon

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