How grep only the capacity infor from df -k using sun solaris


 
Thread Tools Search this Thread
Operating Systems Solaris How grep only the capacity infor from df -k using sun solaris
# 1  
Old 06-04-2009
How grep only the capacity infor from df -k using sun solaris

Hello experts,

when i get an output for df -k;

i get the below output

Filesystem kbytes used avail capacity Mounted on
/dev/vd/vdisk3 8241689 1973089 6186184 25% /
/proc 0 0 0 0% /proc
mnttab 0 0 0 0% /etc/mnttab
fd 0 0 0 0% /dev/fd
/dev/vd/vdisk13 17555046 5107099 12272397 30% /var
swap 43361744 32 43361712 1% /var/run

1. How do i only grep out the column 'capacity' data e.g 25%?
2. From that how do only get capacity more than 50%?

Pls guide me.

rgds
# 2  
Old 06-05-2009
df -k | tr -s ' '| cut -d ' ' -f5

This will give u the capacity

For your 2nd Q ,try to google a little
# 3  
Old 06-05-2009
for 2> you need to have a loop say if loop which will check for value of capacity... if 50 or more then take action else no action.

Smilie
# 4  
Old 06-05-2009
Quote:
Originally Posted by streddy
Hello experts,

when i get an output for df -k;

i get the below output

Filesystem kbytes used avail capacity Mounted on
/dev/vd/vdisk3 8241689 1973089 6186184 25% /
/proc 0 0 0 0% /proc
mnttab 0 0 0 0% /etc/mnttab
fd 0 0 0 0% /dev/fd
/dev/vd/vdisk13 17555046 5107099 12272397 30% /var
swap 43361744 32 43361712 1% /var/run

1. How do i only grep out the column 'capacity' data e.g 25%?
2. From that how do only get capacity more than 50%?

Pls guide me.

rgds
Try this:

Code:
df -k | awk 'int($5) > 50'

Regards
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Solaris

Patching Procedure in Solaris 10 with sun cluster having Solaris zone

Hi Gurus I am not able to find the patching procedure for solaris 10 ( sol10 u11) to latest patchset with sun cluster having failover zones so that same I should follow. Take an instance, there are sol1 and sol2 nodes and having two failover zones like sozone1-rg and sozone2-rg and currently... (1 Reply)
Discussion started by: nick101
1 Replies

2. Solaris

Sun Solaris not able to ping Sun Solaris

I have a Sun Blade 2500 with SUN 5.9 OS installed. I can ping other machines(windowsXP/2003) from my SUN machines but not able to ping each other SUN machines which i have newly installed. (7 Replies)
Discussion started by: z_haseeb
7 Replies

3. Solaris

useful links and help resources for Sun's products and Sun's Solaris

Hi all, Those links might help anyone Knowledge base Video tutorials (0 Replies)
Discussion started by: h@foorsa.biz
0 Replies

4. AIX

How to show hostname infor after login

When I login AIX console, how to show hostname before any command: hostname:/#>id uid=0(root) gid=0(system) groups=2(bin),3(sys),7(security),8(cron),10(audit),11(lp) (15 Replies)
Discussion started by: rainbow_bean
15 Replies

5. Solaris

Sun Fire 280R Sun Solaris CRT/Monitor requirements

I am new to Sun. I brought Sun Fire 280R to practice UNIX. What are the requirements for the monitor/CRT? Will it burn out old non-Sun CRTs? Does it need LCD monitor? Thanks. (3 Replies)
Discussion started by: bramptonmt
3 Replies

6. AIX

How to disable user login infor?

If user login and don't do anything in 15 mins, the user is kicked off from the server. how to disable it? (5 Replies)
Discussion started by: rainbow_bean
5 Replies

7. UNIX for Dummies Questions & Answers

Sun Solaris 10: How do I create a bootup disc? The Sun website confuses me

Hey there, I am starting a Computer Science Foundation year at the end of this month and am trying to get a little bit ahead of the game. I have always wanted to learn Unix and am currently struggling with creating a boot disc to run Solaris (I have chosen to study this) from as opposed to... (0 Replies)
Discussion started by: Jupiter
0 Replies

8. Solaris

Sun Solaris Sun Java Desktop

Ok I a n00b, not gunna hide it so here goes - Sun Solaris, V.10 i386 - during the setup, I can choose a screen resolution that looks great with 65k colors and all. However, when all is said and done 4 disks and a reboot later, I get hanious 640x480 @ 256 only. If I choose the Sun Java Desktop... (20 Replies)
Discussion started by: Spooky
20 Replies
Login or Register to Ask a Question