[Tutor] Parse Text File

Eduardo Vieira eduardo.susan at gmail.com
Wed Jun 10 22:56:10 CEST 2009


On Wed, Jun 10, 2009 at 12:44 PM, Stefan Lesicnik<stefan at lsd.co.za> wrote:
> 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.
>
> Tia!
>
> Stefan
Hello, maybe if you would show a sample on how you would like the
ouput to look like it could help us give more suggestions.

Regards,

Eduardo


More information about the Tutor mailing list