【PowerShell】join 合併陣列, replace 正則替換, out-file 成 csv 格式

從陣列後面push進資料
$thisRow += $row
然後把多個資料合併成一個string
$tables += $thisRow -join ","
這樣就會把thisRow變成
"1,2,3,4,5,6"一行

接著是正則替換

$row = $row -replace "<\S+>",""
再來輸出成csv
$tables| out-file a.csv -Encoding ascii

留言