D&C GLug - Home Page

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

Re: [LUG] sed

 

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


John.

-- 
---------------------------------------------------------------
John Horne, University of Plymouth, UK  Tel: +44 (0)1752 233914
E-mail: John.Horne@xxxxxxxxxxxxxx       Fax: +44 (0)1752 233839

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