Fill a column in a CSV file using POWERSHELL V2

I have a CSV file:

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

How to populate COL3 with the default value of X?

therefore, the result will 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 ++

thank

+5
source share
1 answer
Import-CSV -Path "input.csv" -Delimiter ';' | `
ForEach-Object { $_.COL3 = "x"; return $_ } | `
Export-CSV -Path "output.csv" -Delimiter ';' -NoTypeInformation
+7
source

All Articles