[Tutor] Searching 2 Strings in A File

dohoang4093 at comcast.net dohoang4093 at comcast.net
Wed Jun 6 21:33:32 CEST 2012


i am writing a python script that will be invoked as follows: 

myScript.py <an IP> 

and the script is as follwos: 

x = "Device " + sys.argv[1] + " restored the database" 
y = "Created connection to " + sys.argv[1] 

cmd_line = Popen(["egrep", "(x,y)", aLogFile], stdout=PIPE, stdin=PIPE, stderr=STDOUT) 

the above code does not work because it will look for x and y in aLogFile instead of 
looking for <"Device " + sys.argv[1] + " restored the database"> and <"Created connection to " + sys.argv[1]> 
Any hint is appreciated. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120606/1f6b1c03/attachment-0001.html>


More information about the Tutor mailing list