title: Find and Replace with Spaces using Sed Mac Terminal
body: <p>I have a .CSV file with over 500,000 lines that I need to:</p>
  
  <ol>
  <li>find all 'space double quote space' sequences and replace with nothing</li>
  <li>find all 'space double quote' sequences and replace with nothing</li>
  <li>find all  double quotes and replace with nothing</li>
  </ol>
  
  <p><strong>Example of .CSV line:</strong></p>
  
  <pre><code>"DISH Hartford &amp; New Haven  (Hartford)", "206", "FBNHD", " 06028", " East Windsor Hill", "CT", "Hartford County"
  </code></pre>
  
  <p>** Required output**</p>
  
  <pre><code>DISH Hartford &amp; New Haven  (Hartford),206,FBNHD,06028,East Windsor Hill,CT,Hartford County
  </code></pre>
  
  <p>I need to remove all double quotes (<code>"</code>) and spaces in front of and behind the commas (<code>,</code>).</p>
  
  <p><strong>I've tried</strong> </p>
  
  <pre><code>$ cd /Users/Leonna/Downloads/
  $ cat bs-B2Bformat.csv | sed s/ " //g
  </code></pre>
  
  <p>This gives me the 'command incomplete'  greater than prompt, so I then tried:</p>
  
  <pre><code>$ cat bs-B2Bformat.csv | sed s/ " //g
  sed: 1: "s/": unterminated substitute pattern
  $ cat bs-B2Bformat.csv |sed s/ \" //g
  sed: 1: "s/": unterminated substitute pattern
  $
  </code></pre>
  
  <p>There are too many lines for me to edit in Excel (Excel won't load all the lines) or even a text editor. How can I fix this?</p>