How to delete (remove) a specific line of a text file based on the line number?
<p>I have a simple script that deletes the first n lines of a text file.
</p>

<pre><code>Const FOR_READING = 1 
Const FOR_WRITING = 2 
strFileName = "C:\scripts\test.txt" 
iNumberOfLinesToDelete = 5 

Set objFS = CreateObject("Scripting.FileSystemObject") 
Set objTS = objFS.OpenTextFile(strFileName, FOR_READING) 
strContents = objTS.ReadAll 
objTS.Close 

arrLines = Split(strContents, vbNewLine) 
Set objTS = objFS.OpenTextFile(strFileName, FOR_WRITING) 

For i=0 To UBound(arrLines) 
   If i &gt; (iNumberOfLinesToDelete - 1) Then 
      objTS.WriteLine arrLines(i) 
   End If 
Next 
</code></pre>



<p>I would like to ask if there is a way if you only have a specific line in the text file which you only want to delete? Meaning <strong>based on the line number</strong> of the text file.</p>

<p>For example, 
</p>

<pre><code>1
2
This is line 3
4
5
</code></pre>



<p>And you want to remove line number 3. Specifically line number 3.</p>

<p>Result:
</p>

<pre><code>1
2
4
5
</code></pre>



<p>Is there a way on how to do it? </p>

<p>A big appreciation for the answer and the help.</p>