Groovy script remove newline from StringBuffer
<p>Thanks for taking the time to look into this.</p>

<p>How do I get rid of all newline characters from a StringBuffer?</p>

<p>The file that i'm reading in looks something like this - </p>

<pre><code>USER|SLACK|TRELLO|BINARY|YO!##!
1234|Joe|||10001!##!
3212|Test1|||10001!##!
2213|Tin Man||24|10001!##!
</code></pre>

<p>I tried to use replaceAll(pattern,closure) like shown below. But somehow cant quite get my head around it.</p>

<pre><code>package carriageReturnRemove

class asdf {


static void main(def args){

    String str = new File('C:/org.txt').getText()
    StringBuilder sb = new StringBuilder(str)
    sb = sb.replaceAll(~'/n','')    

}
</code></pre>

<p>}</p>

<p>The output basically needs to look like this - </p>

<pre><code>USER|SLACK|TRELLO|BINARY|YO!##!1234|Joe|||10001!##!3212|Test1|||10001!##!2213|Tin Man||24|10001!##!
</code></pre>

<p>Where am I going wrong? Any help or pointers are greatly appreciated.</p>

<p>Cheers.</p>