I have a script written in ruby. I need to remove any duplicate newlines (e.g.)
\\n \\n \\n
to
\\n
My current
Ruby needs the backslashes escaped differently than you have provided.
str.sub!("\\\\n+\\\\n","\\\\n")
http://www.ruby-forum.com/topic/176239