# Undo added line breaks PutAppend

I used PutAppend to write away a some results. It turns out that Mathematica has inserted annoying line breaks. This is discussed in Why there are line breaks when PutAppend a string to file? and it offers some ways to avoid this from happening in the future. But how do I clean up the files that were already written away with the default PutAppend? Note there are also line breaks that are supposed to be there. Is there a good way to recognized the line breaks that Mathematica decided to add and remove them?

Each separate result was supposed to be printed on a newline

result1
result2


but now there are additional line breaks breaking up the results. I had thought this would make the files nice to read with ReadList. Now it turns out it is terrible due to the unintended line breaks.

• StringReplace[Import[file], "\"\n\"" -> "\"\""]? – kglr Nov 26 '18 at 23:03
• @kglr that replacement leaves the result of Import[file] unchanged. (StringReplace[Import[file], "\"\n\"" -> "\"\""]===Import[file] gives True.) – Kvothe Nov 27 '18 at 10:11