Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
function isnumeric(fld) {
if (fld ~ /^[0-9]+/) {
return 1
}
return -1
}
function convert(fld, line) {
if ( (isnumeric(fld)) ) {
if (length(fld) > 6) {
line = sprintf("%12.1f", fld / 1024000) " GB"
} else if (length(fld) <= 6) {
line = sprintf("%12.1f", fld / 1024) " MB"
}
return line
}
return -1
}
{
if (NR > 1) {
for (i=2 ; i <=4 ; i++) {
if (a = convert($i)) {
$i = a
}
}
}
print
}
df -k | awk '
NR==1 {printf("%s\t\tMB\t%s\t%s\t%s\t%s on\n",$1,$3,$4,$5,$6)}
NR!=1 && length($1) <= 10 {printf("%s\t\t\t%d\t%d\t%d\t%s\t\t%s\n",$1,$2/1024,$3
/1024,$4/1024,$5,$6)}
NR!=1 && length($1) > 10 {printf("%s\t%d\t%d\t%d\t%s\t\t%s\n",$1,$2/1024,$3/1024
,$4/1024,$5,$6)}'