日期:2014-05-16 浏览次数:20602 次
$ awk 'BEGIN{FS="[ GM%]"}NR>=2{if($0 ~ /G/){total+=$3*1024;used+=$3*1024*$5/100}else{total+=$3;used+=$3*$5/100}}END{print "total "total" MB\n""spare "total-used" MB"}' file total 3122 MB spare 3069.3 MB