[Tutor] text processing, reformatting
lconrad at go2france.com
lconrad at go2france.com
Wed Dec 12 15:34:25 CET 2012
From an much larger, messy report file, I extracted these lines:
OPM010 HUNT INGR FRI 16/11/12 00:00:00 QRTR
HTGP PEG OVFL
0012 00000 00000
0022 00000 00000
0089 00000 00000
0379 00000 00000
OPM010 HUNT INGR FRI 16/11/12 00:15:00 QRTR
HTGP PEG OVFL
0012 00000 00000
0022 00000 00000
0089 00000 00000
0379 00000 00000
OPM010 HUNT INGR FRI 16/11/12 00:30:00 QRTR
HTGP PEG OVFL
0012 00000 00000
0022 00000 00000
0089 00000 00000
0379 00000 00000
OPM010 HUNT INGR FRI 16/11/12 00:45:00 QRTR
HTGP PEG OVFL
0012 00000 00000
0022 00000 00000
0089 00000 00000
0379 00000 00000
OPM010 HUNT INGR FRI 16/11/12 01:00:00 QRTR
HTGP PEG OVFL
0012 00000 00000
0022 00000 00000
0089 00000 00000
0379 00000 00000
OPM010 HUNT INGR FRI 16/11/12 01:15:00 QRTR
HTGP PEG OVFL
0012 00000 00000
0022 00000 00000
0089 00000 00000
0379 00000 00000
the engineer needs that reformatted into the "log line" the original
machine should have written anyway, for importing into Excel:
yyyy-mm-dd;hh:mm:ss;<htgp>;<peg>;<ovfl>;
With Bourne shell, I could eventually whack this out as I usually do,
but as a Python pupil, I'd like to see how, learn from you aces and
python could do it. :)
thanks
Len
More information about the Tutor
mailing list