mardi 2 décembre 2014

How to remove SPACES and HYPHENS from list of names


Vote count:

0




So im trying to write a powershell script to do 2 things, the first is to remove any last name that is AFTER the first space,


I got that with



$last_nospace = $_.lname -replace '^([^ ]+ ).+$','$1'


than I want it to also remove any names that are hyphenated (not sure if I can do this at the same time)



$last_nohyphen = $_.lname -replace '-',''


However it seems to give mixxed results, sometimes MULTIPLE names are the same,


Is it possible to easily say



Remove all additional names after the first space or hyphen?


Im creating AD accounts, and I want it always to be uniform.



asked 26 secs ago







How to remove SPACES and HYPHENS from list of names

Aucun commentaire:

Enregistrer un commentaire