Before IRIS there was a trial version. But always only the latest.
There was also no community.  as we know it today.
What you look for is more than 10 years back ! 

this might do it:

Class User.Scott 
{
ClassMethod Clean(infile, outfile) As %Status
{
  set in=##class(%Stream.FileCharacter).%New()
  do in.LinkToFile(infile)
  set out=##class(%Stream.FileCharacter).%New()
  set out.Filename=outfile
  do in.Rewind()
  while 'in.AtEnd {
    set line=in.ReadLine()
    set last=($e(line,*)="|")
    if last set sc=out.WriteLine(line)
    else  set sc=out.Write(line)
  }
  do in.%Close()
  set sc=out.%Save()
  quit sc
}
}

Just to understand your requirements correctly.
- a linebreak  $c(13,10)  would only be acceptable if it follows a segment terminator "|" 
- IF YES Is this just a pipe | or a double pipe || as in your example?
This could be a processing rule to check the last chars of the line
and ignoré the linebreak at a mismatch.   

 

In IRIS you have in SMP the option to run your Query in background and bypass the timeout.

it still exists:

ClassMethod Build(f As %Integer)
{
 s a="#" f i=F:-1:1 w ?i,a,! s a=a_"##"
}

Just forget my contribution.
I'm not interested in digging for secrets!
I leave that to Indiana Jones    
my code is deleted ! it's not my type of fun

Hmm!
Where did you see the enclosing quotes? 
they are invisible in my browser.