I have a very large xml document. I wanted to load it into memory, do a bunch of regex replacements on it, extract some details from it and write the new version back out.
I did this in c#, reading in and passing along the entire file's contents before writing it back out.
In Powershell I'm getting an Out of Memory error. Admittedly, I don't know if I ever processed as large a file with the old application, so I can't be 100% sure this would work.
In any case, I've tried a number of things w/o luck. There are no CRs in the document, so it's one long string. I tried the -ReadSize and -Encoding arguments, w/o any improvements.
(Get-Content "C:\Test\Input.xml" -Encoding Byte -ReadCount 10kb) |
Set-Content -Encoding Byte "C:\Test\output.xml"