title: How to parse only selected column values using awk
body: <p>I have a sample flat file which contains the following block </p>
  
  <pre><code>test my array which array is better array huh got it?
  
  INDIA USA SA NZ AUS ARG ARM ARZ GER BRA SPN
  </code></pre>
  
  <p>I also have an array(ksh_arr2) which was defined like this </p>
  
  <pre><code>ksh_arr2=$(awk '{if(NR==1){for(i=1;i&lt;=NF;i++){if($i~/^arr/){print i}}}}' testUnix.txt)
  </code></pre>
  
  <p>and contains the following integers </p>
  
  <pre><code>3 5 8
  </code></pre>
  
  <p>Now I want to parse only those column values which are at the respective numbered positions i.e. third fifth and eighth.
  I also want the outputs from the 2nd line on wards. 
  So I tried the following </p>
  
  <pre><code>awk '{for(i=1;i&lt;=NF;i++){if(NR &gt;=1 &amp;&amp; i=${ksh_arr2[i]}) do print$i ; done}}' testUnix.txt 
  </code></pre>
  
  <p>but it is apparently not printing the desired outputs. 
  What am I missing ? Please help.</p>