From 1ef4cff3b1a5fb3f01a79a323d17ff8ae632bd2e Mon Sep 17 00:00:00 2001 From: Ville Rantanen Date: Mon, 13 Jul 2015 14:40:57 +0300 Subject: [PATCH] format memory better --- nando-stats | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nando-stats b/nando-stats index 01890a7..2b2b258 100755 --- a/nando-stats +++ b/nando-stats @@ -2,10 +2,10 @@ function filesize { awk 'BEGIN{ x = '$1' - split("B KB MB GB TB PB",type) - for(i=5;y < 1;i--) + split("K M G T P",type) + for(i=5;y < 0.1;i--) y = x / (2^(10*i)) - str=int(y*10)/10 + str=int(y*10)/10 type[i+2] if (x==0) { str = "0" } print str }' || return $?