title: To ignore Pipe in pipe delimited file
body: <p>I am having a file with <code>|</code> separated in which I need to search for the char in 3rd column and replace with it with null. I need to replace only the column where character occurs in 3rd field.</p>
  
  <p>file1.txt</p>
  
  <pre><code>xx|yy|xx|12
  </code></pre>
  
  <p>output file:</p>
  
  <pre><code>xx|yy||12
  </code></pre>
  
  <p>I achieved with this by</p>
  
  <pre><code>awk 'BEGIN {FS=OFS="|" } $3 ~ /[[:alnum:]]/ { $3="" }1' file
  </code></pre>
  
  <p>But what I faced is if there is any column having a pipe char that should consider as single column it shouldn't be counted as a field separator.  </p>
  
  <pre><code>xx|yy|"xyz|xx"|AAA|12...
  </code></pre>
  
  <p>So the output should be like this:</p>
  
  <pre><code>xx|yy|"xyz|xx"||12
  </code></pre>
  
  <p>so AAA should replace with null considering as AAA as 4th column.</p>