Searching 2 Strings in A File

Dave Angel d at davea.name
Wed Jun 6 17:17:19 EDT 2012


On 06/06/2012 05:10 PM, dohoang4093 at comcast.net wrote:
> hi all, 
(You forgot to include the list in your reply)

> 
> thanks a lot for your quick response. 
> 
> Dave, actually it's a 2 arguments. Sorry, i did not make it clear in my question. I used Ramit's hint and it worked. The code should be as follows: 
> 
> pattern = "({0}|{1})".format(x,y) 
> cmd_line = Popen(["egrep", pattern, aLogFile], stdout=PIPE, stdin=PIPE, stderr=STDOUT) 
> 
> Regards, 
> 
> Do Nguyen 
> 

If it's two arguments, then  you need pattern1 and pattern2.

But if it works, perhaps egrep is happy with a single argument.

-- 

DaveA



More information about the Python-list mailing list