Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: last 100 lines from text file


Message #1 by "Martin Bachorik" <bachorikm@a...> on Wed, 21 Feb 2001 10:59:04
I found nice article how to read text file in ASP:



<% @language="vbscript" %>

<% folderspec = ("\\Computername\SshareName$")



Dim fs, f, f1, s, sf

Set fs = CreateObject("Scripting.FileSystemObject")

Set f = fs.GetFolder(folderspec)

Set sf = f.SubFolders

For Each f1 In sf

s = s & f1.name

s = s & vbCrLf

Next

Response.Write s 

%>



Is there a way how to get only last 100 lines (in my case displaiyng LOG 

files with 20MB size takes too long :-)?
Message #2 by "Wally Burfine" <oopconsultant@h...> on Wed, 21 Feb 2001 18:27:30 -0000
Try this:



Dim vLine(99)

Dim iLineNo

...

iLineNo = 0

For each f1 in sf

vLine(iLineNo) = f1.name

iLineNo = iLineNo + 1

if iLineNo > 99 then

    iLineNo  = 0

end if

Next



For i = 0 to 99

   response.write vLine(iLineNo) & "<br>"

   iLineNo iLineNo = iLineNo + 1

   if iLineNo > 99 then

      iLineNo  = 0

   end if

Next



>From: "Martin Bachorik" <bachorikm@a...>

>Reply-To: "ASP Web HowTo" <asp_web_howto@p...>

>To: "ASP Web HowTo" <asp_web_howto@p...>

>Subject: [asp_web_howto] last 100 lines from text file

>Date: Wed, 21 Feb 2001 10:59:04

>

>I found nice article how to read text file in ASP:

>

><% @language="vbscript" %>

><% folderspec = ("\\Computername\SshareName$")

>

>Dim fs, f, f1, s, sf

>Set fs = CreateObject("Scripting.FileSystemObject")

>Set f = fs.GetFolder(folderspec)

>Set sf = f.SubFolders

>For Each f1 In sf

>s = s & f1.name

>s = s & vbCrLf

>Next

>Response.Write s

>%>

>

>Is there a way how to get only last 100 lines (in my case displaiyng LOG

>files with 20MB size takes too long :-)?

Message #3 by "BACHORIK, Martin" <BACHORIKM@a...> on Wed, 21 Feb 2001 21:27:13 +0100
smart :-)

thanks a lot ...



Martin BACHORIK

SAP software engineer

Amylum Europe

tel:	+32 (53) 733891

fax:	+32 (53) 733022

gsm:	+32 (477) 390649

e-mail:	bachorikm@a...


  Return to Index