Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Set oShell = Server.CreateObject("Wscript.Shell")
tmpFile = "$grep" & Int(rnd(1)*5000) & ".txt"
strCmd = "%ComSpec% /c grep -e """ & strGrep & """ C:\TEMP\INDEXFILE.CSV > c:\temp\" & tmpFile
oShell.run strCmd, 1, TRUE
Set filesys = CreateObject("Scripting.FileSystemObject")
Set grepFile = filesys.OpenTextFile("c:\temp\" & tmpFile)
' .... read the file, split it, get what I need....
grepFile.Close
filesys.DeleteFile("C:\temp\" & tmpFile)
set oShell = Nothing
Option Explicit
Dim fso, fnfo, fil_1, fil_2, str_line
Dim search_for : search_for = "NetDDE"
Dim path_1, path_2
path_1 = "C:\Programming\VBScript\TestCsv.csv"
path_2 = "C:\Programming\VBScript\FoundCsv.csv"
Set fso = CreateObject("Scripting.FileSystemObject")
Set fnfo = fso.GetFile(path_1)
WScript.StdOut.WriteLine "Original File: " & Round(fnfo.Size/1024/1024,2) & " MB"
Set fil_1 = fso.OpenTextFile(path_1,1)
Set fil_2 = fso.CreateTextFile(path_2,2,true)
Dim start_time : start_time = timer
Do Until fil_1.AtEndOfStream
str_line = fil_1.ReadLine()
If InStr(str_line,search_for) Then fil_2.WriteLine(str_line)
Loop
fil_1.Close
fil_2.Close
Set fil_1 = Nothing
Set fil_2 = Nothing
WScript.StdOut.WriteLine "Time Elapsed: " & Round((timer - start_time) * 1000) & "ms"
Set fnfo = fso.GetFile(path_2)
WScript.StdOut.WriteLine "New File is: " & Round(fnfo.Size/1024/1024,2) & " MB"
Set fnfo = Nothing
Set fso = Nothing
Original File: 19.94 MB
Time Elapsed: 1344ms
New File is: 0.97 MB
Original File: 19.94 MB
Time Elapsed: 1473ms
New File is: 0.97 MB
Original File: 19.94 MB
Time Elapsed: 1375ms
New File is: 0.97 MB
Original File: 19.94 MB
Time Elapsed: 1363ms
New File is: 0.97 MB