title: Replace multiple consecutive white spaces with one comma in Unix
body: <p>I have the following sed command:</p>
  
  <pre><code>sed 's/\s/,/g' input &gt; output.csv
  </code></pre>
  
  <p>(I got the command from <a href="https://stackoverflow.com/questions/1271222/replace-white-spaces-with-a-comma-in-a-txt-file-in-linux">this</a> related topic)</p>
  
  <p>which turns the following input:</p>
  
  <pre><code>SNP  A1  A2     FRQ    INFO      OR      SE       P
  10:33367054   C   T  0.9275  0.9434  1.1685  0.1281  0.1843
  10:33367707   G   A  0.9476  0.9436  1.0292  0.1530  0.8244
  10:33367804   G   C  0.4193  1.0443  0.9734  0.0988  0.6443
  10:33368119   C   A  0.9742  0.9343  1.0201  0.1822  0.9156
  </code></pre>
  
  <p>into:</p>
  
  <pre><code>SNP,,A1,,A2,,,,,FRQ,,,,INFO,,,,,,OR,,,,,,SE,,,,,,,P
  10:33367054,,,C,,,T,,0.9275,,0.9434,,1.1685,,0.1281,,0.1843
  10:33367707,,,G,,,A,,0.9476,,0.9436,,1.0292,,0.1530,,0.8244
  10:33367804,,,G,,,C,,0.4193,,1.0443,,0.9734,,0.0988,,0.6443
  10:33368119,,,C,,,A,,0.9742,,0.9343,,1.0201,,0.1822,,0.9156
  </code></pre>
  
  <p>I need a command that turns the multiple consecutive spaces into just one commma, to give me an output like this:</p>
  
  <pre><code>SNP,A1,A2,FRQ,INFO,OR,SE,P
  10:33367054,C,T,0.9275,0.9434,1.1685,0.1281,0.1843
  10:33367707,G,A,0.9476,0.9436,1.0292,0.1530,0.8244
  10:33367804,G,C,0.4193,1.0443,0.9734,0.0988,0.6443
  10:33368119,C,A,0.9742,0.9343,1.0201,0.1822,0.9156
  </code></pre>
  
  <p>Any ideas?</p>