title: Removing multiple character 10 from Jsoup scraped text
body: <p>I have quite a large number of files (around 600) which contain text I scraped with Jsoup. The text contains only HTML within <code>&lt;p&gt;</code> and <code>&lt;br&gt;</code> to try and preserve some for of paragraph in the text. The problem is that in some files there is a long sequence of new lines which are read by Java as character 10. In some cases there are over 30 or so, like someone pressing Enter with the key stuck.</p>
  
  <p>I know that it is mostly my fault that the line breaks are there due to the <code>&lt;br&gt;</code> tags but couldn't find a way to preserve only one line break and ditch the rest whilst scraping.</p>
  
  <p>This is the part of the Jsoup code which I am using (which comes from <a href="https://stackoverflow.com/questions/5640334/how-do-i-preserve-line-breaks-when-using-jsoup-to-convert-html-to-plain-text">How do I preserve line breaks when using jsoup to convert html to plain text?</a>)</p>
  
  <pre><code>Document document = Jsoup.connect(url).get();
  document.outputSettings(new Document.OutputSettings().prettyPrint(false));//preserve html linebreaks
  document.select("br").append("\\n");
  document.select("p").prepend("\\n\\n");
  document.select(":containsOwn(\u00a0)").remove();
  String s = document.html().replaceAll("\\\\n", "\n");
  String txtOnly = Jsoup.clean(s, "", Whitelist.none(), new Document.OutputSettings().prettyPrint(false));
  </code></pre>
  
  <p>Would it be somehow possible to clean the contents of the files somehow without actually re-running the scraping process?  I have tried using a HashSet so that only one character 10 is kept and then when the end of line is reached, to print the only character 10 in the set. But it did not work somehow.</p>
  
  <p>Any good pointers as to how to go about doing this please?</p>