title: sed can't differentiate CR from LF if both exist in the same file
body: <p>I have a file where CR (\r) and LF (\n) exists in the same file.</p>
  
  <pre><code>a1 a2 CRLF
  b1 LF
  b2 CRLF
  c1 c2 CRLF
  </code></pre>
  
  <p>The file need to be fixed to:</p>
  
  <pre><code>a1 a2 CRLF
  b1 b2 CRLF
  c1 c2 CRLF
  </code></pre>
  
  <p>The logic is simple: remove LF that is not preceded by CR with empty string:</p>
  
  <pre><code>sed 's/[^\r]\n//g' input.txt &gt; output.txt
  </code></pre>
  
  <p>However, this doesn't work! </p>
  
  <p>I had to delete all the occurrences of LF, and replace all the remaining CR with CRLF  :</p>
  
  <pre><code>cat input.txt | tr -d '\n' | sed 's/\r/\r\n/g' &gt;output.txt
  </code></pre>
  
  <p>this bugs me. why isn't sed working??</p>