Wednesday, 15 February 2017

http://www.snapdba.com/2012/10/readable-df-h-output-in-hp-ux/#.WKSOx09MrIU




After my first encounter with a HP-UX system recently, I soon discovered that annoyingly, neither the df -h or df -g commands work in HP-UX! There are other commands such as df -PK or bdf I’ve found that can provide you with a more readable view of the filesystems, but after a bit of faffing around, I put this together instead:






df -Pk | awk '{


 if ( NR == 1 ) { next }


 if ( NF == 6 ) { print }


 if ( NF == 5 ) { next }


 if ( NF == 1 ) {


 getline record;


 $0 = $0 record


 print $0


 }


 }' | awk '


BEGIN {print "Filesystem                                    Mount Point                 Total GB   Avail GB    Used GB  Used"


       print "--------------------------------------------- ------------------------- ---------- ---------- ---------- -----"}


END {print ""}


/dev/ || /^[0-9a-zA-Z.]*:\// {


printf ("%-45.45s %-25s %10.2f %10.2f %10.2f %4.0f%\n",$1,$6,$2/1024/1024,$4/1024/1024,$3/1024/1024,$5)


}'

No comments:

Post a Comment