[Tutor] Parse Text File

Stefan Lesicnik stefan at lsd.co.za
Wed Jun 10 20:44:25 CEST 2009

Hi Guys,

I have the following text

[08 Jun 2009] DSA-1813-1 evolution-data-server - several vulnerabilities
        {CVE-2009-0547 CVE-2009-0582 CVE-2009-0587}
        [etch] - evolution-data-server 1.6.3-5etch2
        [lenny] - evolution-data-server 2.22.3-1.1+lenny1
[04 Jun 2009] DSA-1812-1 apr-util - several vulnerabilities
        {CVE-2009-0023 CVE-2009-1955}
        [etch] - apr-util 1.2.7+dfsg-2+etch2
        [lenny] - apr-util 1.2.12+dfsg-8+lenny2

... (and a whole lot more)

I would like to parse this so I can get it into a format I can work with.

I don't know anything about parsers, and my brief google has made me think
im not sure I wan't to know about them quite yet!  :)
(It looks very complex)

For previous fixed string things, i would normally split each line and
address each element, but this is not the case as there could be multiple
[lenny] or even other entries.

I would like to parse from the date to the next date and treat that all as
one element (if that makes sense)

Does anyone have any suggestions - should I be learning a parser for doing
this? Or is there perhaps an easier way.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090610/29345d94/attachment.htm>

More information about the Tutor mailing list