Remove 4 Lines from the start of every text file

A simple little command

“c:\temp\FilesIn” is the location of the files to process

“c:\temp\FilesOut\” is the location of the files created with the first 4 lines removed

if you want to remove just  1 line replace the code with  -Skip 1

Copy and paste the following line into a powershell command prompt (watch for the word wrap in the blog)

 

#
get-childitem -path "c:\temp\FilesIn" | foreach-object {$outfile = ("c:\temp\FilesOut\" + $_.name) ; Get-Content $_.fullname | select -Skip 4| set-content $outfile }
#

 

Leave a comment

Your email address will not be published. Required fields are marked *