开发者

Fill in a column in a CSV file using POWERSHELL V2

开发者 https://www.devze.com 2023-01-09 09:05 出处:网络
i have a CSV file : COL1;COL2;COL3;COL4 1;1;;4 6;9;;0 9;8;;4 How do i fill in COL3 wi开发者_运维问答th a default value X?

i have a CSV file :

COL1;COL2;COL3;COL4
1;1;;4
6;9;;0
9;8;;4

How do i fill in COL3 wi开发者_运维问答th a default value X?

so the result would be :

COL1;COL2;COL3;COL4
1;1;x;4
6;9;x;0
9;8;x;4

How can i achieve this using Powershell V2 or even ultra edit or Notepad++

Thanks


Import-CSV -Path "input.csv" -Delimiter ';' | `
ForEach-Object { $_.COL3 = "x"; return $_ } | `
Export-CSV -Path "output.csv" -Delimiter ';' -NoTypeInformation
0

精彩评论

暂无评论...
验证码 换一张
取 消