[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2054
  • 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.

Thanks,
Chetan
0
chetan1981
Asked:
chetan1981
2 Solutions
 
Brian PringleSystems Analyst II, SCM, ERPCommented:
0
 
oBdACommented:
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
0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

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