Hi
I was given text file with list of employees in format lastname firstname and I want to reverse it. I tried this but nothing happens:
(Get-Content -Path d:\employees.txt) | ForEach-Object -Process {
$PSItem -replace "(\w+)\s(\w+)",'$2 $1'
} | Set-Content -Path d:\employees.txt
I guess syntax is an issue since
“donner michael” -replace “(\w+)\s(\w+)”,‘$2 $1’works.