#!/usr/bin/ksh usage=50 time_limit=3 sed -n 's/.*\([0-9]\+\)%.*\([0-9][0-9]\):[0-9][0-9]:[0-9][0-9].*/\1 \2/;T;p' out.txt | \ read percentage hours echo "${percentage}% ${hours}h" if [[ $percentage -gt $usage ]] ;then echo "Disk usage beyond $usage%" #send mail fi if [[ $hours -gt $time_limit ]] ;then echo "Time limit beyond $time_limit hours" #send mail fi