ReadLine--Please help

Results 1 to 5 of 5

Thread: ReadLine--Please help

  1. #1
    Thinkn Guest

    Default ReadLine--Please help

    Please Help<BR>I need to take this text file and only read the 2nd line. But not all of the second line. Only the part after the Open?<BR> <BR>02/13/01 11:46:13 !SOF,30160001<BR>02/13/01 11:46:13 !CAP Open:ok-RB02130018<BR>02/13/01 11:46:13 !EOF,30160001<BR><BR>How can I do this?<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: ReadLine--Please help

    set Fso=Server.CreateObject("Scripting.FileSystemObjec t")<BR>set TxtFile=Fso.OpenTextFile("E:datadummy.txt") <BR>while not TxtFile.AtEndofStream<BR>Session("x")=TxtFile.Read Line<BR>if instr(Session("x"),"this")=1 then<BR>response.write Session("x")<BR>end if<BR>Wend<BR><BR><BR>Try the rest.

  3. #3
    a Guest

    Default RE: ReadLine--Please help

    Try this<BR><BR>Set fso = CreateObject("Scripting.FileSystemObject")<BR>Set File = fso.OpenTextFile("C:inetpubwwwrootfile.txt")<BR>xS tr = File.ReadLine<BR>xStr = File.ReadLine &#039;this rewrites the string so you have the second line!<BR>File.Close<BR><BR>Then what you have to do is take the string xStr and select the data out of that maybe (using Mid or InStr)!

  4. #4
    ThinkN Guest

    Default RE: ReadLine--Please help

    I figured it out by using this...<BR><BR>objOpenFile.skipline<BR> MyLine=ObjOpenfile.Readline<BR> <BR> myLine=Right(myline,10)<BR><BR>Is that oK?

  5. #5
    a Guest

    Default skipline

    Using "SkipLine" is probably better than using the first "readline" as I suggested earlier to skip the line. Basically because my way would have read the first line and If you use a big enough file my method would take a lot longer to process.<BR><BR>So Yes Use SKIPLINE<BR><BR>Using the RIGHT statement will work fine if the length "10" stays constant for every file opened. Otherwise it will get messy.

Posting Permissions

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