Help finding a field value then printing line

Hello,
I'm trying to only print out the file systems that are greater than 90% full.
So far I've got:

df -k >sawky8
cat sawky8 | grep -v Filesystem | sed "s/%//g;" >sawky9
cat sawky9 | awk '{print $4}' | read stot
print $stot
if [ $stot -gt 90 ] ;then
echo $LINE

Problem is it stops after the first line and also doesn't echo it to the tty. Any help much appreciated - I'm still finding my way around KSH!

Cheers

In my test system disk space usage percentage is displayed on 5th column. So this code works for me:

df -kP | awk '{x=$5;sub("%","",x);if (x>90){print}}'

Note that I used "-P" df option, to print every filesystem in just one line, so it is much easier to manipulate with AWK.

1 Like

Shorter :wink:

df -kP | awk 'int($5)>90'