• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2058
  • Last Modified:

Bat file to delete first three lines in text file

Hey guys,

I need a script that will delete the first three lines from a text files.

All help is greatly appreciated.

2 Solutions
Brian PringleSystems Analyst II, SCM, ERPCommented:
Try this (will remove empty lines on its way; if it needs to keep empty lines, say so); input file and output file could ba passed in the command line as well:

@echo off
set InputFile=in.txt
set OutputFile=out.txt
if exist "%OutputFile%" del "%OutputFile%"
for /f "skip=3 delims=" %%a in ('type "%InputFile%"') do >>"%OutputFile%" echo %%a
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now