Delete first line of text file

Samar picture Samar · Mar 1, 2009 · Viewed 53.2k times · Source

I need a cmd script that deletes the first line in my text file. The scenario is the following: I take a txt file from FTP everyday, the problem is that it comes with blank line at the top then the headers of the file. Since I'm importing that file automatically into an access table, that blank line is causing me problems.

So, I need a script that deletes the blank line and saves the file.

Answer

Guido Domenici picture Guido Domenici · Mar 1, 2009

Windows/command prompt:

more +1 filename.ext > otherfilename.ext

That seems to work fine, however it appears that this also converts tab characters into multiple spaces.. I needed to remove the first line of a tab-delimited file before importing into postgres. That failed due to the automatic conversion of tabs to spaces by more...