scripter73
Programmer
Hi,
I've written a script that reads a log file. One input line of this log file is as follows:
10.11.130.80 - - [01/May/2001:13:52:59 -0600] "GET /insuredacct/index.cfm HTTP/1.0" 200 355
I'm trying to split up this one string into multiple string variables to be used later to populate a database.
However, I'm a little stumped on how to read a portion of the buffer, stop reading when I find a space, assign what I've read so far to a string variable, then pick back up reading where I left off.
For example, here's how I want my assignment:
strIP = 10.11.130.80
strId = -
strUser = -
strTime = [01/May/2001:13:52:59 -0600]
strRequest = "GET /insuredacct/index.cfm HTTP/1.0"
strResult = 200
strBytes = 355
Here's the code I have, but so far I'm only able to read an entire line of my file and determine if I have a '.' in the line.
<%
LogFile = "d:\inetpub\
Set LogFileObj = Server.CreateObject("Scripting.FileSystemObject"
Set LogTextFile = LogFileObj.OpenTextFile(LogFile)
dim strBuffer
dim strIP, strID, strUser, strTime, strRequest, strResult, strBytes
strBuffer=LogTextFile.Readline
'***********************************************
' BEGINNING TO SPLIT UP THE FILE INTO VARIABLES
'***********************************************
'determine if there's a . in the buffer
if instr(strBuffer,"." then
response.write "<br>" & "Contains a '.' ." & "<br>"
else
response.write "<br>" & "Does not contain a '.' ." & "<br>"
end if
%>
Any help anyone can provide would be much appreciated.
Thanks,
scripter73
I've written a script that reads a log file. One input line of this log file is as follows:
10.11.130.80 - - [01/May/2001:13:52:59 -0600] "GET /insuredacct/index.cfm HTTP/1.0" 200 355
I'm trying to split up this one string into multiple string variables to be used later to populate a database.
However, I'm a little stumped on how to read a portion of the buffer, stop reading when I find a space, assign what I've read so far to a string variable, then pick back up reading where I left off.
For example, here's how I want my assignment:
strIP = 10.11.130.80
strId = -
strUser = -
strTime = [01/May/2001:13:52:59 -0600]
strRequest = "GET /insuredacct/index.cfm HTTP/1.0"
strResult = 200
strBytes = 355
Here's the code I have, but so far I'm only able to read an entire line of my file and determine if I have a '.' in the line.
<%
LogFile = "d:\inetpub\
Set LogFileObj = Server.CreateObject("Scripting.FileSystemObject"
Set LogTextFile = LogFileObj.OpenTextFile(LogFile)
dim strBuffer
dim strIP, strID, strUser, strTime, strRequest, strResult, strBytes
strBuffer=LogTextFile.Readline
'***********************************************
' BEGINNING TO SPLIT UP THE FILE INTO VARIABLES
'***********************************************
'determine if there's a . in the buffer
if instr(strBuffer,"." then
response.write "<br>" & "Contains a '.' ." & "<br>"
else
response.write "<br>" & "Does not contain a '.' ." & "<br>"
end if
%>
Any help anyone can provide would be much appreciated.
Thanks,
scripter73