With the help of a tutor I was able to get the following code to work the
way I want, but I'd like for it to parse through several files in one folder
and create one output file.

I'm thinking I need to add something like:

def grab_files(files = []):

   found = []
   if files != None:



Here is the original:

import re

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

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

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

infile.close()
outfile.close()
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to