title: Bash shell script Nested while loop with IFS
body: <p>I'm trying to parse a set of csv files using bash shell script the files looks as below:</p>
  
  <pre><code>File1: /tmp/test.txt
  key1,key1file.txt
  key2,key2file.txt
  key3,key3file.txt
  
  Files: /tmp/inter/key1file.txt
  abc,cdf,123,456
  
  Files: /tmp/inter/key2file.txt
  abc,cdf,123,456
  
  Files: /tmp/inter/key3file.txt
  abc,cdf,123,456
  </code></pre>
  
  <p>I've tried parsing these files using 2 while loops:</p>
  
  <pre><code>while IFS="," read keycol keyfile
  do
      while IFS="," read keyval
       do
       echo "inside inner while loop"
       echo "$keycol|$keyval"
      done &lt; "/tmp/inter/$keyfile"
  done &lt; /tmp/test.txt
  </code></pre>
  
  <p>and expecting this code to output</p>
  
  <pre><code>key1,abc
  key1,cdf
  key1,123
  key1,456 and so on...
  </code></pre>
  
  <p>However, i'm not getting any output when i run this code which indicates the second loop is not being executed. Any pointers in the right direction would be of help. Thanks</p>