I have a CSV that contain 24,000+ server names, as well as other information. The columns of the CSV are Name
, Group
, and Target
. An example of the raw data going in for the "Name" column is:
WindowsAuthServer @ wddg9028WIN
I'm trying to find a way to edit the Name
column within the CSV. I need to remove WindowsAuthServer @
, and WIN
from the server names. The only thing I want to be left over is the server name, or wddg9028
for this example. A potential issue is that not every server name has this format, and some only contain the server name. Obviously the ones that are already correct don't need to be changed, but I'm not sure if this will throw things off.
I tried doing:
$test = $file.Name -replace "WindowsAuthServer @ ",""
This returns the names exactly how I want them (minus removing WIN). However whenever I do this, I lose all other columns from the CSV.
Is there a way to edit one column within a CSV? Should it be done as the data is being read in for this case?