Merging two columns in a CSV to make a third
$objs=@();
$output=Import-csv-Path"U:\Abook1.csv"|ForEach {
$Object=New-ObjectPSObject-Property @{
CN =[String]::Concat($_.Surname,$_.Firstname)
Firstname=$_.firstname
Surname=$_.Surname
PersonalRef=$_.PersonalRef
}
$objs+=$Object;
}
$objs
$objs|Export-CSvU:\LeaversFeb2015.csv
Outputs this
CN Firstname PersonalRef Surname
HallJonathan Jonathan 1234156 Hall
I need CN to be Hall, Jonathan so how to I add the separator to
CN =[String]::Concat($_.Surname,$_.Firstname)