greping date in a file

i have a script that checks inside the file and find the start date and end date with time...........

#!/bin/ksh

cd /ednadtu3/u01/pipe/logs

TZ=`date +%Z`+24 ;b=`date +%Y-%m-%d`
echo $b

for i in DBMaint.log
do
echo "Start Time:" >> /ednadtu3/u01/pipe/naveed/Report.txt
cat $i | grep $b | while read LINE1
do
echo $b >> /ednadtu3/u01/pipe/naveed/Report.txt
done

echo "End Time:" >> /ednadtu3/u01/pipe/naveed/Report.txt
cat $i | grep $b | while read LINE2
do
echo $b >> /ednadtu3/u01/pipe/naveed/Report.txt
done
done
------------------------------------------------------------------

this script is returning null result..... i know something is wrong in the logic.

actually i want to cat a file and check the start time of the file and end time of the file........

can anyone help me in that

Does DBMaint.log have timestamp on each line ?
In that case you can simply take the first and last line on that file and cut the date part accordingly.

here is the format of the file

2008-02-18 20:43:17,965 [Thread-14] DEBUG - SummaryReport.sendStatistics(): Statistics Serialized Message Size: 1804

2008-02-19 21:43:17,967 [Thread-14] DEBUG - SummaryReport.sendStatistics(): Statistics Serialized Message Size: 1804

2008-02-19 22:43:17,968 [Thread-14] DEBUG - SummaryReport.sendStatistics(): Statistics Serialized Message Size: 1809

2008-02-19 23:43:17,969 [Thread-14] DEBUG - SummaryReport.sendStatistics(): Statistics Serialized Message Size: 1808

2008-02-19 23:23:17,970 [Thread-14] DEBUG - SummaryReport.sendStatistics(): Statistics Serialized Message Size: 1800

2008-02-20 13:43:17,971 [Thread-14] DEBUG - SummaryReport.sendStatistics(): Statistics Serialized Message Size: 1805
-----------------------------------------------------------------------

how to find the last line and 1st line in the file having this format.it contains some 1000 of lines like this. i m just interested in 2008-02-19 date. in this date how to find 1st and last line

i have got the script for start time and end time.

----------------------------------------------------------------------

#!/bin/ksh

if test -f Report.txt
then
rm Report.txt
fi

cd /ednadtu3/u01/pipe/logs

TZ=`date +%Z`+24 ;b=`date +%Y-%m-%d`
echo $b

for i in DBMaint.log
do
echo "Start Time:" >> /ednadtu3/u01/pipe/naveed/Report.txt
cat $i | grep $b | head -1 >> /ednadtu3/u01/pipe/naveed/Report.txt

echo "End Time:" >> /ednadtu3/u01/pipe/naveed/Report.txt
cat $i | grep $b | tail -1 >> /ednadtu3/u01/pipe/naveed/Report.txt
done

-----------------------------------------------------------------------

the o/p is :

Start Time:
2008-02-19 00:13:16,338 [Thread-14] INFO -

End Time:
2008-02-19 23:43:17,974 [Thread-14] DEBUG - SummaryReport.sendStatistics(): Statistics Serialized Message Size: 1807

---------------------------------------------------------------------

How to find the diff in time ..........