tAdded an awk alternative. Thanks to verkgw - monochromatic - monochromatic blog: http://blog.z3bra.org
(HTM) git clone git://z3bra.org/monochromatic
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit a4aec222b8ea914778a68161ed8debf383599753
(DIR) parent bbb680b4d16c783a987f654eb93ccdf9ef27417e
(HTM) Author: z3bra <willy@mailoo.org>
Date: Wed, 30 Apr 2014 11:21:52 +0200
Added an awk alternative. Thanks to verkgw
Diffstat:
M 2014/04/meeting-at-the-bar.txt | 6 ++++++
1 file changed, 6 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/2014/04/meeting-at-the-bar.txt b/2014/04/meeting-at-the-bar.txt
t@@ -253,6 +253,12 @@ for pointing out the two digit problem (and other things)
LINE=`ps -eo pcpu |grep -vE '^\s*(0.0|%CPU)' |sed -n '1h;$!H;$g;s/\n/ +/gp'`
bc <<< $LINE
+**NOTE**: *verkgw* on irc.blinkenshell.org proposed a faster `awk` alternative.
+I don't know awk enough to come up with this kind of line, so I'll just continue
+with `grep` and `sed`. See the comparison [here](http://i.imgur.com/Aefbl8U.png)
+
+ ps -eo pcpu | awk 'BEGIN {sum=0.0f} {sum+=$1} END {print sum}'
+
#### RAM used
To display RAM usage (percentage of RAM actually by the system), we will use