There is very simple approach to just replace string in a file:
c:\input.txtc:\output.txt
See https://docs.microsoft.com/en-us/visualstudio/msbuild/property-functions?view=vs-2019
to explore inlinable C# code. [System.Text.RegularExpressions.Regex] included into the list.