Code:
Set objFS = CreateObject("Scripting.FileSystemObject")
strFile = "c:\Users\Usuario\textfile.txt"
Set objFile = objFS.OpenTextFile(strFile)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
If InStr(strLine,"Some Line")> 0 Then
strLine = Replace(strLine,"Some Line","")
End If
WScript.Echo strLine
Loop
This is some code I use to parse a text file for "Some Line". The text file is arranged with some lines like this:
Code:
Hello
Goodbye
Some Line
Blah
Blahblah
When I run the script on it, I end up with:
Code:
Hello
Goodbye
Blah
Blahblah
Which is to be expected. But what I really want is:
Code:
Hello
Goodbye
Blah
Blahblah
In other words, I want to backspace the line out of existence, not just replace it with blank space. How should I go about doing that?