title: Replace every comma not enclosed in a pair of double quotes with '|'
body: <p>I want to replace every comma not enclosed in a pair of double quotes with '|' using <a href="/questions/tagged/awk" class="post-tag" title="show questions tagged 'awk'" rel="tag">awk</a> pattern matching within <a href="/questions/tagged/sed" class="post-tag" title="show questions tagged 'sed'" rel="tag">sed</a>.</p>
  
  <p>For example, given the following input:</p>
  
  <pre><code>A,B,"C,D",E,"F,G",H,"I,J,K"
  "Chang, Yao-Jen",33,MIS,"Taiwan, Taipei",M
  </code></pre>
  
  <p>This is the desired output:</p>
  
  <pre><code>A|B|"C,D"|E|"F,G"|H|"I,J,K"
  "Chang, Yao-Jen"|33|MIS|"Taiwan, Taipei"|M
  </code></pre>
  
  <p>I want this accomplished without using hard coding like:</p>
  
  <pre><code>sed '2s/33,MIS/33|MIS|/' file.
  </code></pre>