Hi ,
Yes i have the code :
import re
import datetime
from datetime import timedelta
Header = "*****************************************************"
f3 = open ( r"D:\QI\logA.txt", 'r' )
string = f3.read ()
regex = re.compile ( "\n" )
st = regex.sub ( " ", string )
st1 = st.split ( " " )
if re.search ('ERR-1:', st ):
x = re.findall ( "(\w{3})\s+([0-9]{2})\s+(\d+):(\d+):(\d+)\s+(\d+)", st )
j = x[0][0] + " "+ x[0][1]+" " + x[0][2] +":"+ x[0][3]+":" +
x[0][4]+" " + x[0][5]
h = x[1][0] + " "+ x[1][1]+" "+ x[1][2] +":" + x[1][3] +":"+
x[1][4] +" "+ x[1][5]
y = datetime.datetime.strptime ( j, '%b %d %H:%M:%S %Y' )
print y
k = datetime.datetime.strptime ( h, '%b %d %H:%M:%S %Y' )
print k
f4 = open ( r"D:\QI\logC11.txt", 'r' )
string1 = f4.read ()
reg = re.compile ( "\n" )
newst = reg.sub ( " ", string1 )
newst1 = newst.split ( " " )
if re.search ( "ERR-2", newst ):
a = re.findall ( "\d\d/\d\d/\d\d\s[012][0-9]:[0-5][0-9]:[0-5][0-9]", newst )
for i in range ( len ( a ) ):
newtime = datetime.datetime.strptime ( a[i], '%m/%d/%y %H:%M:%S' )
if newtime > y and newtime < k:
print "Install patch1"
if re.search ( "ERR-3", newst ):
a = re.findall ( "\d\d/\d\d/\d\d\s[012][0-9]:[0-5][0-9]:[0-5][0-9]", newst )
for i in range ( len ( a ) ):
newtime = datetime.datetime.strptime ( a[i], '%m/%d/%y %H:%M:%S' )
if newtime > y and newtime < k:
print newtime, y, k
print "Install patch2"
==============================================================================================
output i get :
*Install patch1 - wrong solution
2018-10-22 10:21:23 2018-10-22 10:21:15 2018-10-22 10:21:25
Install patch2 - correct solution *
*It should have only searched between timestamps **2018-10-22 10:21:15
2018-10-22 10:21:25*
*in logC11.txt what I am doing wrong please adice stuck on this for long.*
Patching tool version 12.2.0.1.0 Production on Mon Oct 22 10:21:15 2018
verify_queryable_inventory returned ERR-1: Latest xml inventory is not loaded
into table
Prereq check failed, exiting without installing any patches.
Patching tool complete on Mon Oct 22 10:21:25 2018
LOG file opened at 04/26/18 06:11:52
ERR-2: OS message: No child processes
operation "wait", location "skudmi:prp:6"
LOG file opened at 10/22/18 09:10:25
ERR-3: patchObjectPossible causes are:"
Trim whitespace same as SQL Loader
LOG file opened at 10/22/18 10:21:23
ERR-3: patchObjectPossible causes are:"
Trim whitespace same as SQL Loader
LOG file opened at 10/22/18 10:22:25
ERR-3: patchObjectPossible causes are:"
Trim whitespace same as SQL Loader
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor