parsing text in blocks and line too

flyzone at technologist.com flyzone at technologist.com
Thu Apr 12 05:30:01 EDT 2007


Goodmorning people :)
I have just started to learn this language and i have a logical
problem.
I need to write a program to parse various file of text.
Here two sample:

---------------
trial text bla bla bla bla error
      bla bla bla bla bla
      bla bla bla on more lines
trial text bla bla bla bla warning bla
      bla bla more bla to be grouped with warning
      bla bla bla on more lines
      could be one two or ten lines also withouth the tab beginning
again text
text can contain also blank lines
text no delimiters....
--------------
Apr  8 04:02:08 machine text on one line
Apr  8 04:02:09 machine this is an error
Apr  8 04:02:10 machine this is a warning
--------------
parsing the file, I'll need to decide if the line/group is an error,
warning or to skip.
Mine problem if how logical do it: if i read line by line, I'll catch
the error/warning
on first and the second/third/more will be skipped by control.
Reading a group of line i could lose the order on the output: my idea
is to have
an output in html with the line in the color of the check (yellow for
warning,
red for error).
And i have also many rules to be followed so if i read one rule and
then i search
on the entire file, the check will be really slow.

Hope someone could give me some tips.
Thanks in advance




More information about the Python-list mailing list