How about just:

awk '{if(/bogomips/){print $3}}' < /proc/cpuinfo | bc 6121.06


(NB. Adding a + with awk and removing the newline with tr, only to reverse 
both of those with cut is futile.)

Although just:

echo "File 6210.06 is unavailable."

Would probably be the simplest ;)

All the best...

Mike
---
Michael S. E. Kraus
Administration
Capital Holdings Group (NSW) Pty Ltd
p: (02) 9955 8000




James Gregory <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
18/03/2003 06:33 PM

 
        To: 
        cc:     Penguinillas <[EMAIL PROTECTED]>
        Subject:        Re: [SLUG] Silly shell challenge


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

James.

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



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

Reply via email to