Replacing text in notepad files

Hi everyone,

So I have a folder which contains 23 files which were generated from a SSIS package (SQL data converted to XML files).

These files are .xml extension and named like Individual_1.xml, Individual_2.xml, Individual_3.xml, Individual_4.xml and so on…

Each file is around 500-800 mbs.

In these files there is some un-wanted text that I want to replace.

Originally I did this using a powershell query with in the SSIS package but for some reason its not working anymore.
The file size is too big may be and it takes forever to load or open and sometimes it gives error out of memory exception and sometimes it just keeps loading.

Can anyone suggest any other way I can achieve this?

What exactly does that mean? What changed? Please keep in mind - we cannot see your screen and we cannot read your mind.

You did not show us what way you used until now.

Here is my code:

cd D:\2022-07-04\1_SAVE_XML\TEST\
$test = Get-ChildItem -Path D:\2022-07-04\1_SAVE_XML\TEST\ -Name 
$test2 = (Get-ChildItem -File | Measure-Object).Count
$test2 = ($test2 -($test2-1)) 
foreach($row in $test)
(Get-Content $row) -replace ' xmlns:xsi=""', ''| Set-Content -encoding ASCII $row
(Get-Content $row) -replace ' xsi:nil="true" ', '' | Set-Content -encoding ASCII $row
$test2 = $test2 +1

When I first wrote this code and executed it, it worked without any issue.
The un-wanted text was removed and file was saved just the way I wanted it.
But now when I run it, it doesnt work anymore.
Only thing changed between the first time and now is I reinstalled my OS on the laptop.

Either it just keeps running and no error message appears or sometimes it just show out of memory exception error.

Well … the error message is pretty obvious. There’s not enough memory available.

BTW: Your variable names are atrocious.

You may try something like this:

$FileList = Get-ChildItem -Path D:\2022-07-04\1_SAVE_XML\TEST\ -Filter *.xml
$FileCount = $FileList.Count
$loopCount = 1
foreach ($File in $FileList) {
    $NewContent = 
        Get-Content -Path $File.FullName |
            ForEach-Object {
                $_ -replace ' xmlns:xsi=""' -replace ' xsi:nil="true" '
    $NewContent | Set-Content -encoding ASCII $File.FullName
    $loopCount ++

And please do not post images of code or error messages. Instead post the plain text and format it as code.

Thanks in advcance