How to Remove First two lines of text file or csv

How to Remove First two lines of text file
Sample Code for text file:

(get-Content "C:\Users\sumeet.kumar\Desktop\Services\Scripts\Power Shell Scripts\List All Secondry Drive\Machinelist.txt" | Select-Object -Skip 4) | out-file "C:\Users\sumeet.kumar\Desktop\Services\Scripts\Power Shell Scripts\List All Secondry Drive\sumeet.txt"

Sample Code for .csv file:

$csv = Get-Content "C:\Users\sumeet.kumar\Desktop\Services\Scripts\Power Shell Scripts\List All Secondry Drive\Machinelist.txt"

$csv = $csv[2..($csv.count - 2)]

$csv > "C:\Users\sumeet.kumar\Desktop\Services\Scripts\Power Shell Scripts\List All Secondry Drive\machinelist1.txt"

Comments

Popular posts from this blog

Enterprise CA option is greyed out / unavailable

Rearm the Office 2013 installation

MP has rejected registration request due to failure in client certificate