Results 1 to 2 of 2

Thread: Extracting data from a log file

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 1999
    Posts
    26

    Post

    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

  2. #2
    Guest

    Post

    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: [email protected]

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width