Programme one:
Disks= ('DF|sed1d |awk '{print $1,$5}'|TR-D%') Len=${#disks [@]} for((i=1; i<= $len; i=i+2)); Do if[${disks[i]}-GT the]; Then Echo "${disks[$i-1]} ${disks[$i]}" fi Done
Scenario Two:
DF -th| awk ' [ |%]+ ' ' nr>1 {if ($6>80) print $} '
Programme III:
DF -tph| awk ' +$6>80 {print $} '
Note that the + number before $6, when using the arithmetic operator, the operand is automatically converted to a numeric value, as follows:
[Email protected] ~]#DF-tphfilesystem Type Size used Avail use%mounted on/dev/sda3 ext34.0G 790M3.0G +% /Tmpfs Tmpfs 12G012G0%/dev/SHM/DEV/SDA7 Ext4 878G1.2G 832G1% /data0/DEV/SDB1 ext4 459G 117G 319G -% /data1/DEV/SDB2 ext4 459G 196G 240G $% /data2/DEV/SDC1 ext4 917G 205G 666G -% /data3/DEV/SDD1 ext4 917G 203G 669G -% /data4/DEV/SDF1 ext4 917G 203G 668G -% /Data5/DEV/SDG1 ext4 917G 202G 670G -% /data6/DEV/SDH1 ext4 917G 623G 248G the% /Data7/dev/sda5 ext37.9G 203M7.3G3% /tmp/DEV/SDA1 ext3 12G6.9G4.4G +% /usr/dev/sda6 ext37.9G1.1G6.5G the% /Var[[email protected]~]#DF-tph|awk '{print $6}' Use% +%0%1% -% $% -% -% -% -% the%3% +% the%[[Email protected]~]#DF-tph|awk '{print +$6}'0 +01 - $ - - - - the3 + the
Turn from
Shell Monitoring Disk Usage | Don't know the real person
Http://peiqiang.net/2015/07/07/use-shell-script-monitor-disk-usage.html?utm_source=tuicool
Shell monitoring disk usage "Go"