Have a list of usernames, they are formatted in one of two ways:
John Smith
John.Smith
I would like to get just the last name from each line in a text file.
I'm guessing I have to use a -replace or -remove command, just not sure how to format the regex.
I have this:
$source = "path\to\name\list.txt"
$final = "path\to\final\output.txt"
(Get-Content $source -Raw) -replace "^.\.|^."", "" | Set-Content $final
but it's not working.