You can use more +1 to skip the first line of the file. Then you can connect it to a temporary one (you cannot edit text files in place):
for %x in (*.txt) do (more +1 "%x">tmp & move /y tmp "%x")
After that, you can use a similar method to re-add the first line:
for %x in (*.txt) do ((echo X,Y,Z& type "%x")>tmp & move /y tmp "%x")
If you use files in a batch file, be sure to double the % signs:
@echo off for %%x in (*.txt) do ( more +1 "%%x" >tmp move /y tmp "%%x" ) rem Run your utility here for %%x in (*.txt) do ( echo X,Y,Z>tmp type "%%x" >>tmp move /y tmp "%%x" )
Well, apparently, more does not work with files that are too large, which surprises me. Alternatively, that should work if your file does not contain empty lines (although this is similar to the CSV from what I put together):
for %%x in (*.txt) do ( for /f "skip=1 delims=" %%l in ("%%x") do (>>tmp echo.%%l) move /y tmp "%%x" )
source share