So, I have this command I am trying to convertfrom-csv - but one entry can have a blank - which gets lost…
The result will be like -
User Dept State Zip Time Location
Me IT MO 123456 12:30 Main
You MO 123456 1:30 Downtown
So,
Select-Object $Result -Skip 1 | ForEach-Object {($_ -replace '\s{2,}',',')}
That replaces each space with a comma and double commas with single…
getting -
Me,IT,MO,123456,12:30,Main
You,MO,123456,1:30,Downtown
Then
Me,IT,MO,123456,12:30,Main
You,MO,123456,1:30,Downtown
So… I would convert that from CSV - but the second line is missing a column!! Which throws everything off.
How to compensate for that missing column??
CommandToGetResult |
Select-Object -Skip 1 |
ForEach-Object {($_ -replace '\s{2,}', ',').Trim()} |
ConvertFrom-Csv -Header $Header