Hi All , I have the following code to search for an error and prin the solution .
/A/B/file1.log size may vary from 5MB -5 GB f4 = open (r" /A/B/file1.log ", 'r' ) string2=f4.readlines() for i in range(len(string2)): position=i lastposition =position+1 while True: if re.search('Calling rdbms/admin',string2[lastposition]): break elif lastposition==len(string2)-1: break else: lastposition += 1 errorcheck=string2[position:lastposition] for i in range ( len ( errorcheck ) ): if re.search ( r'"error(.)*13?"', errorcheck[i] ): print "Reason of error \n", errorcheck[i] print "script \n" , string2[position] print "block of code \n" print errorcheck[i-3] print errorcheck[i-2] print errorcheck[i-1] print errorcheck[i] print "Solution :\n" print "Verify the list of objects belonging to Database " break else: continue break The problem I am facing in performance issue it takes some minutes to print out the solution . Please advice if there can be performance enhancements to this script . Thanks, _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor