Peter Brown
Nov 20th, 1999, 12:10 AM
I need to extract some data from a log file which has a known format produced by another programme.
The data I need is contained in lines 11, 27, 47 etc (increasing from 11 in multiples of 18).
These lines have a common structure relating the item processed and various properties eg
"ITEM 1 PROPERTY A","PROPERTY VALUE"
"ITEM 1 PROPERTY B","PROPERTY VALUE"
"ITEM 1 PROPERTY C","PROPERTY VALUE"
"ITEM 1 PROPERTY D","PROPERTY VALUE"
"ITEM 2 PROPERTY A","PROPERTY VALUE"
"ITEM 2 PROPERTY B","PROPERTY VALUE"
"ITEM 2 PROPERTY C","PROPERTY VALUE"
"ITEM 2 PROPERTY D","PROPERTY VALUE" etc.
Currently I read EACH line, check for the required property using string compare on the part of the line containing the property name and if true extract the property value.
Is there a better way to do this checking only those lines that I know corrrespond to the data I want to extract as I have not been able to figure one out.
Peter Brown
The data I need is contained in lines 11, 27, 47 etc (increasing from 11 in multiples of 18).
These lines have a common structure relating the item processed and various properties eg
"ITEM 1 PROPERTY A","PROPERTY VALUE"
"ITEM 1 PROPERTY B","PROPERTY VALUE"
"ITEM 1 PROPERTY C","PROPERTY VALUE"
"ITEM 1 PROPERTY D","PROPERTY VALUE"
"ITEM 2 PROPERTY A","PROPERTY VALUE"
"ITEM 2 PROPERTY B","PROPERTY VALUE"
"ITEM 2 PROPERTY C","PROPERTY VALUE"
"ITEM 2 PROPERTY D","PROPERTY VALUE" etc.
Currently I read EACH line, check for the required property using string compare on the part of the line containing the property name and if true extract the property value.
Is there a better way to do this checking only those lines that I know corrrespond to the data I want to extract as I have not been able to figure one out.
Peter Brown