title: How do I replace double quotes within csv fields but not add a trailing double quote to each line?
body: <p>I have a csv file named data_export_20130206-F.csv. It contains data that contains double quotes (") which is making it very messy to parse. </p>
  
  <p>File looks kind of like this (but with more fields)</p>
  
  <pre><code>"stuff","zipcode"
  "&lt;?xml version="1.0" encoding="utf-8" ?&gt;","90210"
  </code></pre>
  
  <p>I want to "escape" the quotes that are within the fields so it will look like this (Note: the quotes within the xml have been doubled):</p>
  
  <pre><code>"stuff","zipcode"
  "&lt;?xml version=""1.0"" encoding=""utf-8"" ?&gt;","90210"
  </code></pre>
  
  <p>But when I run this: </p>
  
  <pre><code>cat data_export_20130206-F.csv| sed -E 's@([^,])(\")([^,])@\1""\3@g'
  </code></pre>
  
  <p>Unfortunately, It adds an additional double quote at the end of each line making the document invalid.</p>
  
  <pre><code>"stuff","zipcode""
  "&lt;?xml version=""1.0"" encoding=""utf-8"" ?&gt;","90210""
  </code></pre>
  
  <p><strong>How do I replace double quotes within csv fields but not add a trailing double quote to each line?</strong></p>