Shell Script to Search for a particular String and copy the timestamp to a variable

Hi,
We Perfrom Loads to the database through a Perl script which generates a statistics file. I need to read the statistics. the Statistics file looks something like below:

Process Beginning - 08-26-2010-23.41.47
DB2 CONNECTION SUCCESSFUL!
Ready to process and load file:  FILENAME
# of rows in the TABLENAME table before inserts was 8364
FILENAME - RECORDS READ COUNT:  4838
FILENAME - INSERTED ROW COUNT:  129
FILENAME - ERROR RECORDS COUNT:  0
# of rows in the audit.ELIG_RESP_AUDIT  table after inserts was 8493
Process Complete 08-26-2010-23.41.49

There are many instance like the above in a single file.I am able to open the file and read line by line. But, my requirement is to read the Process Beginning, INSERTED ROW COUNT: and Process Complete into three variables. The count should keep on adding between a process.

can anyone please help me with this?

Try something like...

$ cat file1
Process Beginning - 08-26-2010-23.41.47
DB2 CONNECTION SUCCESSFUL!
Ready to process and load file:  FILENAME
# of rows in the TABLENAME table before inserts was 8364
FILENAME - RECORDS READ COUNT:  4838
FILENAME - INSERTED ROW COUNT:  129
FILENAME - ERROR RECORDS COUNT:  0
# of rows in the audit.ELIG_RESP_AUDIT  table after inserts was 8493
Process Complete 08-26-2010-23.41.49

$ eval $(awk '/Process Beginning/  { print $2 "[" ++c "]=" $NF }
            /INSERTED ROW COUNT/ { i+= $NF ; print "Inserted[" c "]=" i }
            /Process Complete/   { print $2 "[" c "]=" $NF }' file1)

$ echo ${Beginning[1]} ${Inserted[1]} ${Complete[1]}
08-26-2010-23.41.47 129 08-26-2010-23.41.49

$

So guess every instance has only one Process Beginning, INSERTED ROW COUNT and Process Complete .

awk '
/Process Beginning/ { printf  $NF " "}
/INSERTED ROW COUNT/ { printf $6 " "}
/Process Complete/   { printf $NF "\n"}
' statistics.file |while read LINE
do
   # add the jobs here
done.