well, you can convert it to nawk
Code:
df -k | nawk '
function num_to_letter(val) {
if (val=="1") notation = "K"
else if (val=="2") notation = "M"
else if (val=="3") notation = "G"
else notation = "Error"
return notation
}
function num_convert(v) {
cnt=0
CONV_FACTOR=1024
while ( (v / CONV_FACTOR) > 1 ) {
v /= CONV_FACTOR;
cnt++;
}
return v""num_to_letter(cnt);
}
{
print num_convert($2)
}
'
code courtesy of matrix. I leave you to do the rest.