title: trim trailing tabs from a string/column in awk
body: <p>I have a file containing 4 columns separated by tabs. In the last column there can be sometimes trailing tabs between the quotation marks.
  It is a similar question to <a href="https://stackoverflow.com/questions/20600982/trim-leading-and-trailing-spaces-from-a-string-in-awk">trim leading and trailing spaces from a string in awk</a>. Here is an example:</p>
  
  <pre><code>col1 col2 col3 col4
  "12" "d" "5" "this is great"
  "13" "d" "6" "this is great&lt;tab&gt;"
  "14" "d" "7" "this is great&lt;tab&gt;&lt;tab&gt;"
  "15" "d" "8" "this is great"
  "16" "d" "9" "this is great&lt;tab&gt;"
  </code></pre>
  
  <p>This is what I come up with so far:</p>
  
  <pre><code>gawk --re-interval -F '"' 'NF = 9 {if ($8 ~ /\t$/) {gsub(/[\t]+$,"",$8)} ;}'
  </code></pre>
  
  <p>The problem is that it destroys my format meaning I get no quotation marks for each column. The good thing is that the tabs in between the columns are still there:</p>
  
  <pre><code>col1 col2 col3 col4
  12 d 5 this is great
  13 d 6 this is great
  14 d 7 this is great
  15 d 8 this is great
  16 d 9 this is great
  </code></pre>
  
  <p>What do I do wrong?</p>