I need a scrip that will show me the filesystems that are greater than 70%...but not sure how to filter using the df -h | grep
Thank you for your help!!
I need a scrip that will show me the filesystems that are greater than 70%...but not sure how to filter using the df -h | grep
Thank you for your help!!
Grep doesn't understand numerals. Doing that in grep would be awkward at best.
In any case we don't know what your df -h output looks like. It's not the same everywhere.
This is just an example of what it looks like..
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rootvg-rootlv
5.0G 3.3G 1.4G 71% /
tmpfs 4.0K 0 4.0K 0% /dev/vx
/dev/cciss/c0d0p1 251M 87M 152M 37% /boot
none 7.9G 0 7.9G 0% /dev/shm
/dev/mapper/rootvg-homelv
1008M 34M 923M 4% /home
/dev/mapper/rootvg-optlv
2.0G 1021M 894M 54% /opt
/dev/mapper/rootvg-tmplv
3.0G 473M 2.4G 17% /tmp
How about this
df -h | perl -ne 'print if (/(\d+)%/ && $1>70)'
Something like this:
df -h | awk 'NR == 1 { print ; next }
NF==6 { gsub("%",""); if ($5 > 35) print ;next }
NF==1 { gsub(" ",""); a=$0;next}
{ gsub("%",""); $1=$1; if ($4 > 35) print a" "$0 }'
df -h|nawk '{gsub(/%/,"");if($5>70)print}'
Thanks
Sha
df -h|nawk 'int($5)>70'