Perl script to scan through files

Dear perl gurus,
I plan to create a script that will scan through a logfile line by line.
And if ever a certain line meets the below conditions, it will alert me via email.
-->
a) Position 10 to 13 = "ABCD"
b) And also if the amount specified in position 620-640 is less than the amount in position 560-580
Ex: Position620-640 = 00000002000000.000000
Position560-580 = 00000005000000.000000

Thanks in advance :slight_smile:

#!/bin/sh
while read line
do
  if [ "`echo $line | cut -c 10-13`" = "ABCD" -a `echo $line | cut -c 620-640` -lt `echo $line | cut -c 560-580` ]
  then
    echo $line >> /tmp/$$.txt
  fi
done
if [ -r /tmp/$$.txt ]
then
  /your/favourite/email/program you@wher.you.are < /tmp/$$.txt
  rm /tmp/$$.txt
fi

Untested