title: awk: parse columns like: [1,2,3] in csv file
body: <p>I have a csv file that looks like so:</p>
  
  <pre><code>a, b, c
  1, 2, [1, 2, 3]
  4, 5, [7, 7, 7, 7, 8]
  5, 3, []
  6, 5, [45, 45, 2, 1, 2, 8, 8]
  </code></pre>
  
  <p>I would like to extract the third column via <code>awk</code>, which to me means telling <code>awk</code> that the field separator is any comma not inside a pair of brackets. So I would like to extract:</p>
  
  <pre><code>c
  1,2,3
  7, 7, 7, 7, 8
  
  4, 4, 2, 1, 2, 8, 8
  </code></pre>
  
  <p>I tried using a regular expression to set the <code>FS Field Separator</code> like so on the Ubuntu command line:</p>
  
  <pre><code>awk '{FS = ["^\[],[^\]]"} {print $3}' file.csv
  </code></pre>
  
  <p>But this printed out:</p>
  
  <pre><code>c
  [
  [
  []
  [4
  </code></pre>
  
  <p>which is not even close to what I like. Is this a problem with how I am defining my field separator or have I done something else wrong as well? Thanks for any input.</p>