How to ignore white space and comma when reading from a file
<p>I have a comma separated file and i need to extract third field from each line.File test.txt has following contents:</p>

<pre><code>6,STRING TO DECIMAL WITHOUT DEFAULT,cast($src_fld as DECIMAL(15,2) $tgt_fld 
7,STRING TO INTERGER WITHOUT DEFAULT,cast($src_fld as integer) $tgt_fld                
10,DEFAULT NO RULE,'$default' $tgt_fld
</code></pre>

<blockquote>
  <p>cat test.txt |  awk -F, '{print $3}'</p>
</blockquote>

<p>if i write above command ,i get an incorrect output as :</p>

<pre><code>&gt; cast($src_fld as DECIMAL(15
&gt; cast($src_fld as integer) $tgt_fld
&gt; '$default' $tgt_fld
</code></pre>

<p>Can anyone please tell me how to achieve it.I need to write it in a loop so that further processing can be done later. Please note that each third field may contain white space and comma(,).</p>