i have a log file in this format:
Code: Select all
Tue Feb 05 12:35:31 SST 2013
ORA-00060: Deadlock detected. More info in file /opt/ora10g/admin/OCEANSIT/udump/oceansit_ora_5520.trc.
Sun Mar 10 16:15:31 SST 2013
ORA-00060: Deadlock detected. More info in file /opt/ora10g/admin/OCEANSIT/udump/oceansit_ora_5820.trc.
Thu Mar 14 18:25:31 SST 2013
ORA-00060: Deadlock detected. More info in file /opt/ora10g/admin/OCEANSIT/udump/oceansit_ora_5940.trc.
Fri Mar 15 11:45:31 SST 2013
ORA-00060: Deadlock detected. More info in file /opt/ora10g/admin/OCEANSIT/udump/oceansit_ora_5950.trc.
Sat Apr 27 17:30:31 SST 2013
ORA-00060: Deadlock detected. More info in file /opt/ora10g/admin/OCEANSIT/udump/oceansit_ora_5999.trc.
Sun Apr 28 14:15:31 SST 2013
ORA-00060: Deadlock detected. More info in file /opt/ora10g/admin/OCEANSIT/udump/oceansit_ora_6020.trc.
Mon Apr 29 17:15:31 SST 2013
ORA-00060: Deadlock detected. More info in file /opt/ora10g/admin/OCEANSIT/udump/oceansit_ora_6620.trc.
lets say today date is -> Tue 04/30/2013, i only want to show 1 week old ORA-error from the log.
output:
Code: Select all
Sat Apr 27 17:30:31 SST 2013
ORA-00060: Deadlock detected. More info in file /opt/ora10g/admin/OCEANSIT/udump/oceansit_ora_5999.trc.
Sun Apr 28 14:15:31 SST 2013
ORA-00060: Deadlock detected. More info in file /opt/ora10g/admin/OCEANSIT/udump/oceansit_ora_6020.trc.
Mon Apr 29 17:15:31 SST 2013
ORA-00060: Deadlock detected. More info in file /opt/ora10g/admin/OCEANSIT/udump/oceansit_ora_6620.trc.
would appreciate if given some head start.
at the moment i am able to spilt the dd mm yy, but was concern how to work with things like leap year, some months that is of 29, 30, 31 days. Is there any function to do the comparing between the log file timestamp and system timestamp?
Code: Select all
set CurDate=13Jan2012
set yr=%Date:~-4,4%
set mth=%DATE:~-7,2%
set dte=%DATE:~-10,2%
if %mth% == 01 set mth=Jan
if %mth% == 02 set mth=Feb
if %mth% == 03 set mth=Mar
if %mth% == 04 set mth=Apr
if %mth% == 05 set mth=May
if %mth% == 06 set mth=Jun
if %mth% == 07 set mth=Jul
if %mth% == 08 set mth=Aug
if %mth% == 09 set mth=Sep
if %mth% == 10 set mth=Oct
if %mth% == 11 set mth=Nov
if %mth% == 12 set mth=Dec
set CurDate=%dte%%mth%%yr%
ECHO %CurDate%