Need help with writing shell script

I have the following output. I want to write a script to check for

  1. waits > 0 on all rowsand Ratio > .0. if true then send email.
    =========================
    ROLLBACK SEGMENT CONTENTION
    =========================

If any ratio is > .01 then more rollback segments are needed

NAME WAITS GETS Ratio
------------------------------ ---------- ---------- ---------
SYSTEM 0 209 .00000
RB0 0 199 .00000
RB1 0 923 .00000
RB2 0 199 .00000
RB3 0 199 .00000
RB_BIG 0 199 .00000

thanks, Jigar

In the following script, awk counts, then prints, the number of alert lines. Either of the two conditions on a line will trigger an alert. If both need to be true on the same line, then change the || to &&.

#!/bin/sh
awk '\
BEGIN {while (substr($0,1,8)!="--------") getline}
{if ($2>0 || $4>0.1) alerts++}
END {print alerts}' rollback.lst |
read alerts

if [ "$alerts" -gt 0 ] ; then
   echo 'alert(s) found, do sendmail here'
fi

exit 0

Following version of the script can be used for testing. Instead of counting the lines, it will print each line and indicate ALERT or not:

#!/bin/sh
awk '\
BEGIN {while (substr($0,1,8)!="--------") getline}
{if ($2>0 || $4>0.1)
    msg="  ALERT"
 else
    msg=""
 printf "%-9s%4d  %10f%s\n",$1,$2,$4,msg}
' rollback.lst
exit 0