alias of df : capacity > 80%

alias of df : capacity > 80%

Post by tristan_.. » Wed, 16 Feb 2000 04:00:00



Dear all,

   I want to use df -k to show only those fs > 80% of capacity ?
Any idea ?

TH

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

alias of df : capacity > 80%

Post by Ronn » Wed, 16 Feb 2000 04:00:00




Quote:>   I want to use df -k to show only those fs > 80% of capacity ?

df -k | perl -n -e '/\s(\d+)%/ && $1>80 && print'

df -k | awk '/%/ {if(0+substr($5,1,length($5)-1)>80) print;}'


http://profiles.yahoo.com/ronny_fischer/
http://fusshuhn.ourfamily.com/cppincomp.html

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!

 
 
 

alias of df : capacity > 80%

Post by tristan_.. » Thu, 17 Feb 2000 04:00:00






> >   I want to use df -k to show only those fs > 80% of capacity ?

> df -k | perl -n -e '/\s(\d+)%/ && $1>80 && print'

> df -k | awk '/%/ {if(0+substr($5,1,length($5)-1)>80) print;}'

  It works perfect in the command line but I can't hard code it
to an alias for ksh ...

  Pls advise.

TH


> http://profiles.yahoo.com/ronny_fischer/
> http://fusshuhn.ourfamily.com/cppincomp.html

> * Sent from RemarQ http://www.remarq.com The Internet's Discussion
Network *
> The fastest and easiest way to search and participate in Usenet -
Free!

Sent via Deja.com http://www.deja.com/
Before you buy.
 
 
 

alias of df : capacity > 80%

Post by Ken Pizzi » Thu, 17 Feb 2000 04:00:00





>> df -k | perl -n -e '/\s(\d+)%/ && $1>80 && print'

>> df -k | awk '/%/ {if(0+substr($5,1,length($5)-1)>80) print;}'

>  It works perfect in the command line but I can't hard code it
>to an alias for ksh ...

>  Pls advise.

Even though it would be possible to make this an alias,
I advise using a function instead of an alias:
  function df80 { df -k | awk '$5 ~ /%/ && (0+$5) > 80 {print}'; }

                --Ken Pizzini

 
 
 

alias of df : capacity > 80%

Post by Kel » Sat, 19 Feb 2000 04:00:00



>   I want to use df -k to show only those fs > 80% of capacity ?
>Any idea ?

You could use awk or perl ... it looks very nice, works 100% of the time and
takes years to master.
Or  you could do it on the cheap !!

alias df80="df -k | egrep '100%|9.%|8.%'"

It will work 99% of the time, and takes 1% of the mental gymnastics.
You wont get paid as much, but you will have more free time !

- KL

 
 
 

alias of df : capacity > 80%

Post by Kel » Sat, 19 Feb 2000 04:00:00



>   I want to use df -k to show only those fs > 80% of capacity ?
>Any idea ?

You could use awk or perl ... it looks very nice, works 100% of the time and
takes years to master.
Or  you could do it on the cheap !!

alias df80="df -k | egrep '100%|9.%|8.%'"

It will work 99% of the time, and takes 1% of the mental gymnastics.
You wont get paid as much, but you will have more free time !

- KL