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"
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
Post a Comment