Filesystem usage with more than 80%.

Hi All,

I need to display the output of rah "df -m" only for the filesysytems those are touching or crossing 80%. Im using SuSE Linux box and the output of original rah command is-

/dev/NODE0001
                        557900    446681     83319  75% /db2fs/NODE0001
/dev/NODE0002
                        557900    425400    104600  80% /db2fs/NODE0002
/dev/NODE0003
                        557900    428895    101105  85% /db2fs/NODE0003

My desired output should come like this-

/dev/NODE0002
                        557900    425400    104600  80% /db2fs/NODE0002
/dev/NODE0003
                        557900    428895    101105  85% /db2fs/NODE0003

Can anybody tell me the command using awk or similar to that please?

Thanks,
Naresh

one way:

df -m | awk 'NF==1 {fs=$0} NF>1 && $(NF-1)+0 > 80 {print fs"\n"$0}' 

Hi Anchal,

I've added something more to my query, please have a look at my post.

Thanks for the reply. I'll try it out.

df -m | awk 'int($4) >= 80 {print s RS $0}{s=$0}'

Thanks Anchal for the quick reply. It is working fine now.

Thanks has been forwarded to Franklin52 :slight_smile: