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

Java Control Panel Icon "Application Not Found"

Enterprise CA option is greyed out / unavailable

Unable to connect to Wireless profile being pushed using GPO