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

The install4j wizard could not find a Java Runtime Environment on your system. Please locate a suitable JRE...

Clients Unable to update - "Cached cookie has expired or new PID is available"

Java Control Panel Icon "Application Not Found"