I have a .csv file with below content.
XXXGRP1001 – XXX-AD-groupname
I would like to replace "-" at 10th character with "," and split in to columns in three columns A(first 10 characters) and B(remaining characters) and Third column C will have AD-group users.
Is it a csv file or is it a text file? You could read the content of a text file with Get-Content and treat every line as needed or you could import your csv file with Import-CSV and treat the specific column as needed.
Example using just your string snippet...
$StringToSplit = @'
$StringToSplit -replace ' – ',',' -replace 'AD-','AD,'
You must be logged in to reply to this topic.