0
我有以下表格的CSV:PowerShell中導入CSV,刪除行+改變標題行和出口返銷到CSV
我想達成什麼是導入CSV,刪除所有直到第二個標題行爲止,然後將其導回到帶有新標題的csv中。
我已經寫了下面的,但似乎並沒有工作:
$csvimport = get-content C:\Win12simpleExpComp.csv
$firstline = "Header1, Header2, Header3, Header4"
$csvpre = $csvimport.Where({ $_ -like "$firstline" },'SkipUntil');
$csvpre | Export-Csv -NoTypeInformation C:\export.csv
我得到在導出CSV是象下面這樣:
PSPath,"PSParentPath","PSChildName","PSDrive","PSProvider","ReadCount","Length"
C:\Win12simpleExpComp.csv,"C:\","Win12simpleExpComp.csv","C","Microsoft.PowerShell.Core\FileSystem","39","205"
確實是這樣做的,謝謝Andrey – Archie