The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: Awk script
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 04-07-2008
aigles's Avatar
aigles aigles is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,433
The output for oracle and rads01 is splitted over two lines.
So for this filesystems, the Use% fiels is 4, not 5.

Try and adapt the awk command :

Code:
df -k | \
awk '
   ! ( /\/dev\/shm/ || /cdrom/ ) {
      sub(/%/, "");
      Use = (NF == 6 ? 5 : 4)
      print $(Use+1),$Use
   }  '

Jean-Pierre.