From: http://www.cpuug.org/index.php?topic=132.0
#!/bin/sh
#=====================================================
#
# newdf - An improved human readable display of the HP-UX
# display filesystems command.
#
# Version 1.1
# Author: Scott Buffington
#
# Change History:
# Scott Buffington - 10/30/2006 - Created
# Scott Buffington - 03/18/2008 - Fixed Linewrap issue.
#
# License: GPL, http://www.gnu.org/copyleft/gpl.html
#
#=====================================================
awkscript="/tmp/newdf.$$"
trap "rm -f $awkscript" EXIT
cat << 'EOF' > $awkscript
function showunit(size)
{ mb = size / 1024; prettymb=(int(mb * 100)) / 100;
gb = mb / 1024; prettygb=(int(gb * 100)) / 100;
if ( substr(size,1,1) !~ "[0-9]" ||
substr(size,2,1) !~ "[0-9]" ) { return size }
else if ( mb < 1) { return size "K" }
else if ( gb < 1) { return prettymb "M" }
else { return prettygb "G" }
}
BEGIN {
printf "%-27s %8s %8s %8s %8s %-s\n",
"Filesystem", "Size", "Used", "Avail", "Capacity", "Mounted"
}
!/Filesystem/ {
size=showunit($2);
used=showunit($3);
avail=showunit($4);
printf "%-27s %8s %8s %8s %8s %-s\n",
$1, size, used, avail, $5, $6
}
EOF
df -Pk | grep -v "libc_psr.so.1" | sed -e :a -e '$!N;s/\n / /;ta' -e 'P;D' | awk -f $awkscript