How to calculate the time difference...

Hi All,

I've written a script which reads all the systems backup information and saves it in a log file.

ssh -l ora${sid} ${primaryhost} "tail -2 /oracle/$ORACLE_SID/sapbackup/back$ORACLE_SID.log" |head -1 | awk '{print echo "PREVIOUS:-- Start Date&Time: " $3,$4,echo "|| End Date&Time: "$5,$6,echo "|| RETURN CODE = "$7}' >> ${RESULTFILE}
ssh -l ora${sid} ${primaryhost} "tail -1 /oracle/$ORACLE_SID/sapbackup/back$ORACLE_SID.log" | awk '{print echo "CURRENT :-- Start Date&Time: " $3,$4,echo "|| End Date&Time: "$5,$6,echo "|| RETURN CODE = "$7}' >> ${RESULTFILE}

The output shows as below:

PREVIOUS:-- Start Date&Time: 2008-09-30 06.00.01 || End Date&Time: 2008-09-30 06.00.49 || RETURN CODE = 5
CURRENT :-- Start Date&Time: 2008-10-01 06.00.06 || End Date&Time: 2008-10-01 09.31.29 || RETURN CODE = 0

Now i want to calculate the time taken from start to End and display it in the last..

$3$4-$5$6 = how much time taken should display hours:minutes

PREVIOUS:-- Start Date&Time: 2008-09-30 06.00.01 || End Date&Time: 2008-09-30 06.00.49 || RETURN CODE = 5 (HR:MM)
CURRENT :-- Start Date&Time: 2008-10-01 06.00.06 || End Date&Time: 2008-10-01 09.31.29 || RETURN CODE = 0 (HR:MM)

How do we do this..??????????????????

Any help is appreciated..

Thank you in advacne..

To calculate dates you can check one of those links here:

http://www.unix.com/answers-frequently-asked-questions/13785-yesterdays-date-date-arithmetic.html

Regards