D&C GLug - Home Page

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

Re: [LUG] sed

 

John Horne wrote:
> On Sat, 2007-05-26 at 20:23 +0100, Simon Williams wrote:
>>> # Speed:
>>> some_command | sed 's/^fan[0-9]\+: *\([0-9]\+\) RPM.*/\1/'
>> Thanks.
>>
>>> # Temp:
>>> some_command | sed 's/[^:]*: *+\([0-9]\+\)C.*/\1/'
>> The second one doesn't work for some reason.
>>
> Works for me - using FC6/bash:
> 
>     echo "CPU Temp:    +34C  (low  =   +15C, high =   +45C)   sensor =
>             thermistor" | sed 's/[^:]*: *+\([0-9]\+\)C.*/\1/'
>     34
> 
> (where '34' is the result).

Hmmm. It might have something to do with the degrees symbol, which 
wasn't displaying at all on the terminal I was using.

-- 
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