On Tue, Mar 18, 2003 at 06:33:44PM +1100, James Gregory wrote:
> On Tue, 2003-03-18 at 18:19, Jeff Waugh wrote:
> 
> > Your mission: To work out what it's doing, why you'd be stupid enough to
> > want to do it, and then how to do it better. It has to be in shell, and it
> > has to handle decimals! :-)
> 
> You're a bad, bad man. I have been known to waste days reducing such
> expressions, but not today! Just one simplification to make it spawn 1
> less process:
> 
> awk '{if(/bogomips/){ print "+" $3 }}' < /proc/cpuinfo | tr -d '\n' |
> cut -c 2- | blah blah blah

I think I win. :)

grep '^bogomips[[:space:]]*: ' /proc/cpuinfo | sed -e 's/^.*: //'

Now... depending on just how anal you wanna be, the grep pattern could
just be 'bogomips'. You could also replace the sed with cut -c 12- if
you don't mind the leading space. ie:

grep -F bogomips /proc/cpuinfo | cut -c 12-

:)

-- 
"Other countries of course, bear the same risk. But there's no doubt his
hatred is mainly directed at us. After all this is the guy who tried to
kill my dad."
        - George W. Bush Jr, 'President' of Regime of the United States
          September 26, 2002 (from a political fundraiser in Huston, Texas)

-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to