The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 -->
  #1 (permalink)  
Old 04-07-2008
oduth oduth is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 7
Awk script

Hi all,

I can't see some of file systems capacity output with file system name using below script:

here is the df output:
Code:
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda3             15116868  11890900   2458064  83% /
/dev/sda1               101086     13517     82350  15% /boot
none                  32435708         0  32435708   0% /dev/shm
/dev/mapper/ffderora-gghlvora
                      28092588   5301140  21364404  20% /oracle
/dev/sdi1            114222112 107657120   6564992  95% /orad2
/dev/sdh1            228444256 215828000  12616256  95% /orad9
/dev/sdj1            228444256 215594592  12849664  95% /orad10
/dev/sdk1            228444256 215086688  13357568  95% /orad11
/dev/sdl1            228444256 172073280  56370976  76% /orad12
/dev/sdm1            228444256 209843648  18600608  92% /orad1
/dev/mapper/ffderora-gghlvora
                     280995708 195028872  71696128  74% /rads01
Here is my script:
Code:
df -k | grep -v /dev/shm | grep -v cdrom | awk '{print $6,$5}' | tr -d \%
and its output:

Code:
/ 85
/boot 15

/oracle
/orad2 95
/orad9 95
/orad10 95
/orad11 95
/orad12 90
/orad1 92

/rads01
As you can see above output, /oracle and /rads01 file-systems have no capacity output since they have one more line (double-line)

how can i fix it?

Regards,

Last edited by Yogesh Sawant; 04-07-2008 at 05:00 AM.. Reason: added code tags