[Tutor] parse problem

fleet@teachout.org fleet@teachout.org
Sun, 11 Aug 2002 10:06:44 -0400 (EDT)


Have created a little script to scan my procmail filter for some
information and ran into a little problem.  I have the following type
lines of interest:

procmail: Matched "216.19.163.134"
procmail: Matched "inbox.lv"
procmail: Matched "spambites.com"
procmail: Matched "Bill(s) 1618"

To create the "fields" in this case, I'm using:

log=open("log","r")
for rline in log.readlines():
   line=string.split(rline," ")
   if line[1]=="Matched":
      line1=line[2][1:-2]
      print "%s %s" % (line1, curdate)

This works fine except for cases like the last line above where the
"field" I want consists of words separated by spaces.  I only want the
information between the quotes.

I don't think I should be using the quotes for field separators, as most
of the log consists of quoted items as:

procmail: Assigning "INCLUDERC=/home/fleet/.procmail/action.rc"
procmail: No match on "^From.*(fleet|root)@fleet1\.paxp\.com"
procmail: Assigning "INCLUDERC=/home/fleet/.procmail/root.rc"
procmail: Match on "root@raq2\.paxp\.com"
procmail: Assigning "LASTFOLDER=root"
procmail: Opening "root"

Any thoughts?

				- fleet -