Macro freezes at Execute Shell Script

remove text from variable Macro (v11.0.2)

Macro freezes at Execute Shell Script

This macro will freeze/stop when the Var2 variable reaches about 196655 characters. Works ok up to that point. I was originally working with a 418kb file that was stopping also. I am not sure what "limit" is being reached. I prefer to use the grep command because it is fast. TIA.

remove text from variable.kmmacros (197 KB)

My first thought was that I would use a temporary file rather than push the use of variables so hard. This also seems to be the conclusion of this post from Peter, from 2015:
Maximum size of a Keyboard Maestro variable string?

I did try that initially which was stopping the macro also. I also thought there was an issue with maybe hidden characters in the files or strings but did not find anything. I may have missed something though. file size and/or variable size seems to be the problem but that doesn't make sense to me.