I'm using this script for GeekTools on mac and the code below worked on previous OSX versions. However in Mavericks, it returns the error specified below.
$ top -l1 | grep "PhysMem"|awk '{print "X"int(($2+$4)/($8+$10)*50)"X"}'
awk: division by zero
input record number 1, file
source line number 1
Output before awk:
$ top -l1 | grep "PhysMem"
PhysMem: 6796M used (936M wired), 1282M unused.
As awk is an uncharted territory for me, could someone please post a quick fix for that?
Cleaning your solution by removing unneeded parentheses and int
top -l1 | awk '/PhysMem/ {print int((1-$6/($2+$6))*50)}'
42