
how to remove first two lines from txt file?
Quote:
> hi folks,
> still very much a newbie to scripting...
> have need to remove (top) first 2, 3, or 4 lines
> from a textfile... number of lines depends on
> file being processed...
> also have same need for the bottom 5, 6 lines...
> would appreciate very much any helpful
> examples of how to do this is vb script...
Here's some pseudo code for you that you can translate
into
VBScript:
Dim iLineCount
Dim iCurLine
-Create FSO object
-Open text file for reading
' Get line count
-Do while not at end of text file
iLineCount = iLineCount + 1
-Loop
-Create a temp text file for writing
-Do while not at end of text file
' Get the first 4 lines or so
- If iCurLine < 4 then
- write the line to the temp text file
- End If
' Get the last 6 lines or so
- If iCurLine > iLineCount - 6 then
- write the line to the temp text file
- End If
- iCurLine = iCurLine + 1
-Loop
-close both files
' The temp text file has the lines you need
-Chad