I would like to replace the n'th character in a file with another - so for example you have
Type:1BANKFROMBANK1TO2 -> Type:2BANKFROMBANK1TO2
Type:2BANKFROMBANK1TO2 -> Type:2BANKFROMBANK1TO2
Type:3BANKFROMBANK1TO2 -> Type:2BANKFROMBANK1TO2
Type:4BANKFROMBANK1TO2 -> Type:2BANKFROMBANK1TO2
I do not know what the value will be, but I know at what place it will be - so for this example the 6th character.
When attempting to do it like this:
$Replace = Get-ChildItem "C:\temp\" -Filter "xfil*"
Foreach ($file in $Replace) {
(Get-Content $File.fullname).replace((Get-Content $File.fullname)[5],'x') | Set-Content -Path $file.FullName
}
It replaces every occurence of the character which is expected but not exactly what I want- how do I go around that?