PDA

Click to See Complete Forum and Search --> : Extracting data from a log file


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

Nov 20th, 1999, 01:52 AM
to skip a line :

line input #MyFileNumber, StringVar 'ignores this line because the next overwrites it immediately:

line input #MyFileNumber, StringVar


so:
do until eof(MyFileNumber)
for jj = 0 to 9
line input #MyFileNumber, StringVar
next jj
line input #MyFileNumber, StringVar
if StringVar ...'analyse the string or whatever... then...end if
loop

the above code skips 10 lines and uses the 11th for whatever purpose you intended. ok?
contact me for help.

Woss the .txt file expert, (yeah right!)

-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

Wossname,
Email me: wossnamex@talk21.com :)

[This message has been edited by wossname (edited 11-20-1999).]