Need your help to remove Carriage return (`r) & new line character (`n) from my XML file. I'm getting System.OutOfMemoryException error
The size of File :600 MB
Number of Lines: 1
Input File Format
<File1>
<SubFile1> </SubFile1>
<SubFile2> </SubFile2>
<SubFile3> </SubFile3>
.........
<SubFilen> </SubFilen>
</File1>
Code used
$content = [IO.File]::ReadAllText($input_File)
$content = $content.Replace("`r","")
$content = $content.Replace("`n","")
[system.io.file]::WriteAllText($Output_File,$content)
Also tried
Get-Content
I tried with MaxMemoryPerShellMB 1024, 2048, 4096 but no luck.
(Get-Content .\file.xml)-join''C:\Temp\File_Encoding.ps1 "input.xml" "output.xml"I'm getting error when I try to execute like belowC:\Windows\syswow64\Windowspowershell\v1.0\Powershell.exe -noprofile -executionpolicy bypass -File "C:\Temp\Change_File_Encoding.ps1" "input.xml" "output.xml"