title: how to find continuous blank lines and convert them to one
body: <p>I have a file -- a, and exist some continues blank line(more than one), see below:</p>
  
  <pre><code>cat a
  1
  
  2
  
  
  3
  
  
  
  4
  
  5
  </code></pre>
  
  <p>So first I want to know if exist continues blank lines,  I tried </p>
  
  <pre><code>cat a | grep '\n\n\n'
  </code></pre>
  
  <p>nothing output. So I have to use below manner</p>
  
  <pre><code>vi a 
  :set list
  /\n\n\n
  </code></pre>
  
  <p>So I want to know if exist other shell command could easily implement this? 
  then if exist two and more blank lines I want to convert them to one? see below</p>
  
  <pre><code>1
  
  2
  
  3
  
  4
  
  5
  </code></pre>
  
  <p>at first I tried below shell </p>
  
  <pre><code>sed 's/\n\n\(\n\)*/\n\n/g' a
  </code></pre>
  
  <p>it does not work, then I tried this shell</p>
  
  <pre><code>cat a | tr '\n' '$' | sed 's/$$\(\$\)*/$$/g' | tr '$' '\n'
  </code></pre>
  
  <p>this time it works. And also I want to know if exist other manner could implement this?</p>