1 |
On Tuesday 6 May 2008, 13:37, Joe User wrote: |
2 |
|
3 |
> fixed some bugs: |
4 |
> |
5 |
> echo `uptime|sed 's/.*up\s*\([0-9]*\).*/\1\/10+/';grep '^cpu |
6 |
> MHz' /proc/cpuinfo|awk '{print $4"/30+";}';free|grep '^Mem'|awk |
7 |
> '{print $3"/1024/3+"}';df -P -k -x nfs -x smbfs|awk '{if ($1 ~ |
8 |
> "/dev/(scsi| sd)"){ s+= $2} s+= $2;} END {print |
9 |
> s/1024/50"/15+70";}'`|sed 's/,/./'| bc|sed 's/\(..$\)/.\1cm/' |
10 |
|
11 |
As Neil sed, almost everything can be done with awk. Then, Willie said |
12 |
that the double count for devices is a bug. Thus: |
13 |
|
14 |
echo `uptime|awk '{print $3"/10+"}'; awk '/^cpu MHz/{print |
15 |
$4"/30+"}' /proc/cpuinfo; free|awk '/^Mem/{print $3"/1024/3+"}'; |
16 |
df -Pk -x nfs -x smbfs|awk 'NR>1{s+=$2} END{print s/1024/50"/15+70"}'`| |
17 |
bc|sed 's/.$/.&cm/' |
18 |
|
19 |
which shortens my length to 105.0cm >:-( |
20 |
-- |
21 |
gentoo-user@l.g.o mailing list |