Brad
12-13-2002, 11:19 AM
Good morning,
I'm trying to extract certain lines from a textstream, but can't work out how to do it. Below is a paragraph from the file i'm using:
Firstname_Lastname Password = "testpassword"
Service-Type=Framed,
Framed-protocol=MPP,
Ascend-Route-IP=Route-IP-Yes,
Ascend-Data-Svc = Switched-128K,
Ascend-Metric=1,
Framed-Routing=None,
Ascend-Idle-Limit = 300,
Ascend-Assign-IP-Pool=1
The file is basically a long list of such paragraphs.
I'd like to extract and display only those lines which contain the Password section (ie the top line of each paragraph. Is there a way to do this ? I started as below, but it's not working...
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.OpenTextFile(Server.MapPath("users.txt"), 1)
do while f.AtEndOfStream = false
if f.Readline = "'%" & "password" & "'" Then
Response.Write(f.ReadLine)
Response.Write("<br>")
end if
loop
f.Close
Set f=Nothing
Set fs=Nothing
Alternatively, I've linked the text file into an MSAccess database, and would like to extract the lines which = the same...again, i've started, but it ain't working...
set objrs = server.createobject("ADODB.recordset")
password = " password"
SQLStr = "SELECT Users.Field1 FROM Users WHERE (((Users.Field1) Like '%" & password & "'));"
objrs.open SQLStr, objconn
response.write SQLStr
Thanks a lot in advance,
Brad.
I'm trying to extract certain lines from a textstream, but can't work out how to do it. Below is a paragraph from the file i'm using:
Firstname_Lastname Password = "testpassword"
Service-Type=Framed,
Framed-protocol=MPP,
Ascend-Route-IP=Route-IP-Yes,
Ascend-Data-Svc = Switched-128K,
Ascend-Metric=1,
Framed-Routing=None,
Ascend-Idle-Limit = 300,
Ascend-Assign-IP-Pool=1
The file is basically a long list of such paragraphs.
I'd like to extract and display only those lines which contain the Password section (ie the top line of each paragraph. Is there a way to do this ? I started as below, but it's not working...
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.OpenTextFile(Server.MapPath("users.txt"), 1)
do while f.AtEndOfStream = false
if f.Readline = "'%" & "password" & "'" Then
Response.Write(f.ReadLine)
Response.Write("<br>")
end if
loop
f.Close
Set f=Nothing
Set fs=Nothing
Alternatively, I've linked the text file into an MSAccess database, and would like to extract the lines which = the same...again, i've started, but it ain't working...
set objrs = server.createobject("ADODB.recordset")
password = " password"
SQLStr = "SELECT Users.Field1 FROM Users WHERE (((Users.Field1) Like '%" & password & "'));"
objrs.open SQLStr, objconn
response.write SQLStr
Thanks a lot in advance,
Brad.