Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TextStream Questions

Status
Not open for further replies.

angst

IS-IT--Management
Feb 15, 2002
4
CA
hello,
ok I've made a script that reads into a log file,
I've also set it to read into each line, and count the number of lines that begine with a certain character,

what I would like to know is how to display only those lines?

here's the code I've got so far:

<%
Set fs=Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set f=fs.OpenTextFile(Server.MapPath(&quot;testread.txt&quot;), 1)

iLineCount = 0
iLineCount_Special = 0
Do Until f.AtEndOfStream 'or whatever this should be
f.Skip(21)
sLine = f.ReadLine
iLineCount = iLineCount + 1


If Left(sLine, 4) = &quot;dest&quot; Then
iLineCount_Special = iLineCount_Special + 1
End If

If Left(sLine, 4) = &quot;file&quot; Then
iLineCount_Special2 = iLineCount_Special + 1
End If

Loop

Response.Write iLineCount & &quot; total SC log file entries.<br />&quot;
Response.Write iLineCount_Special & &quot; total stream requests.<br />&quot;

Response.Write iLineCount_Special2 & &quot; total ondemand file requests.<br />&quot;

Set f=Nothing
Set fs=Nothing


Set fs=Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set f=fs.OpenTextFile(Server.MapPath(&quot;testread.txt&quot;), 1)

Response.Write (&quot;<br>&quot;)
Response.Write (&quot;<table border=1 cellspacing=1 cellpadding=1><tr><td><font face=arial size=3><b>Line Number</b></td><td><font face=arial size=3><b>Action Logged</b></font></td></tr>&quot;)

do while f.AtEndOfStream = false
Response.Write(&quot;<tr><td><font face=arial size=2>Line:&quot; & f.Line & &quot; </font></td>&quot;)
'Response.Write(&quot;<td><font face=arial size=2>Column:&quot; & f.Column & &quot; </font></td>&quot;)
f.Skip(19)
Response.Write(&quot;<td><font face=arial size=2>&quot; & f.ReadLine & &quot;</font></td>&quot;)
Response.Write(&quot;</td></tr>&quot;)
loop

f.Close



Set f=Nothing
Set fs=Nothing
%>

thanks for your time in advance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top