Remove only First blank line of .txt file

July 14, 2010 at 04:36:16
Specs: Windows XP
Hi. I have looked hi and low for a simple version of this.

Basically I have a text file that is generated. The first line is always blank and then the rest of the content is there. There are other line breaks that I do want to keep Basically all I need is to delete the first line. The first line is always empty. It would be great if it was just one line of a .bat or .VBS, but at all cost it has to be a .vbs.

Also assume that I can do other stuff in this file, I.e I have a .vbs which adds in lines and finds and replaces stuff in this file, I just need a for loop to get and delete the first line return, I don’t need the code to open and close the file, just a line to stick into an already existing .vbs file,

I have tried other scripts such as http://www.computing.net/answers/pr... but this deletes the first line that has text in it, which is wrong, I need it simply to delete the first, and only the first line break in the file.

I hope that this will make the contents on the second line be the first line.

It seems weird that there is no easy way to do this.

-----------------------------
<<LINE BREAK>>
text texttdjhsagdjkasgdsjagdfasdfhgsda
TEXTdggdshagfdhgsafdhgas

More textdasdasdasdasdassasdsasasadaasda
Sadsadsadas

More text.
------------------------------


I need it to look like

---------------------------
text texttdjhsagdjkasgdsjagdfasdfhgsda
TEXTdggdshagfdhgsafdhgas

More textdasdasdasdasdassasdsasasadaasda
Sadsadsadas

More text.
-----------------

Any Ideas ?


See More: Remove only First blank line of .txt file

Report •

#1
July 14, 2010 at 06:02:18
Actually belay that. I was able to get it with

contents = Replace(contents,VbNewLine,"",1,1)


Report •
Related Solutions


Ask Question