bdf には-hオプションがない

のでむかし書いた(2006年ごろだったとおもわれる) hdf
#! /usr/bin/awk -f
# df -h like bdf for HP-UX 11.11,11.23

BEGIN{

while ("bdf" | getline  > 0) {
bdfout[++i]=$0
}
close("bdf")

sub(/kbytes/,"Size",bdfout[1]);

split(bdfout[1],label);

printf("%s\t\t%s\t%s\t%s\t%s\t%s %s\n",label[1],label[2],label[3],label[4],label[5],label[6],label[7]);
  for(x=2;x<=i;x++){
 split(bdfout[x],arr)
 printf("%s\t\t%s\t%s\t%s\t%s\t%s\n",arr[1],si_put(arr[2]),si_put(arr[3]),si_put(arr[4]),arr[5],arr[6])
  }

}

function si_put(kbyte){
 if (kbyte > 1024^2-1){ 
 return sprintf("%0.2fG",kbyte/1024/1024) 
 }else if (kbyte > 1024-1){
 return sprintf("%1.0fM",kbyte/1024)
        }else {
 return sprintf("%1.0fk",kbyte)
        }

}

コメント

このブログの人気の投稿

4.3.0 Temporary Lookup Failureでドツボってた話

tomcat起動時の環境変数でJRE_HOMEを指定するときに

何が得られて何処へ向かうかだけを問うべき