>I sent a sample of the file "testin.txt" in the last email.  Here are the
> lines themsevles:

Oh! Sorry. I didn't look in the attachments - I expected the lines in the 
email. My mistake.
Try this ~~   :-P


##############################
import re

infile = open("testin.txt","r")
outfile = open("out.txt","w")

patt = re.compile(r".*src=([\d\.]*) dst=([\d\.]*).*")

for line in infile:
  m = patt.match(line)
  if m:
    outfile.write("src=%s dst=%s\n"%m.groups())

infile.close()
outfile.close()
#############################

Seeing the input file makes me wonder if regular expressions is over kill in 
this instance.

JS 

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to