title: adding array contents into a csv file
body: <p>I've scoured many sites trying to resolve my issue, but most answers is related to using a single array.
  I'm trying to read 2x text files. Each file is filled with multiple csv lines.
  From these two files do I search and select very specific information.
  My aim to then to write a single CSV file filled with info I selected.
  I've achieved reading the 2x input files. I managed to get my selected specific data.
  How I captured the data was to use arrays.
  I effectively read up to max of 64x values per parameter. There is approx 20x such parameters.</p>
  <p>as an example, I do this by using:</p>
  <pre><code>parameter1[counter]
  parameters2[counter] etc
  </code></pre>
  <p>All 20x parameters values are related to one another and this is what the counter value ensures.</p>
  <p>What I need to do with these captured values is to write a csv file.
  Every line (up to 64x max) should contains 20x parameters.</p>
  <p>So, expected results should be:</p>
  <pre><code>para1-1,para2-1,para3-1,para4-1,,,,,
  para1-2,para2-2,para3-2,para4-2,,,,,
  etc.
  </code></pre>
  <p>Here is some code to show what I've done:</p>
  <pre><code>vall=&quot;Value=&quot;
  write1count=1
  recallcount=1
  
  # functions here
  
  read1_function() {
   exec 8&lt;$file1
              while read -r cap1in &lt;&amp;$FD1
               do
   if [[ &quot;$maccount&quot; -lt 65 ]]; then
      mac_function
      fi
   if [[ &quot;$antcount&quot; -lt 65 ]]; then
      ant_function
      fi
   if [[ &quot;$namecount&quot; -lt 65 ]]; then
      name_function
      fi
  let count++
  done &lt; &quot;$file1&quot;
  }
  
  mac_function() {
   macvariable=&quot;OID=.1000.3.1.6.2.1.12.&quot;
   if [[ &quot;$cap1in&quot; == *$macvariable* ]]; then
     let maccount++
     if [[ &quot;$cap1in&quot; == *$macvariable$maccount* ]]; then
       macaddress[maccount]=${cap1in#*$vall}
    fi
   fi
   }
  
  ant_function() {
   antvariable=&quot;OID=.1000.3.1.6.2.1.6.&quot;
   if [[ &quot;$cap1in&quot; == *$antvariable* ]]; then
     let antcount++
     if [[ &quot;$cap1in&quot; == *$antvariable$antcount* ]]; then
       antconf[antcount]=${cap1in#*$vall}
    fi
   fi
   }
  
  name_function() {
   namevariable=&quot;OID=.1000.3.1.6.2.1.4.&quot;
   if [[ &quot;$cap1in&quot; == *$namevariable* ]]; then
     let namecount++
     if [[ &quot;$cap1in&quot; == *$namevariable$namecount* ]]; then
       nameconf[namecount]=${cap1in#*$vall}
    fi
   fi
   }
  
  # step is to create export file containing all customer config
   exec 6&gt;$file3   #open file3 to dump new config in
  
   while [ $recallcount -lt 65 ]; do
   echo recall $recallcount
    if [[ &quot;${macaddress[recallcount]}&quot; == *:* ]]; then
     echo $write1count,2,1,${macaddress[recallcount]},${antconf[recallcount]},${nameconf[recallcount]} &gt;&gt;$file3
  
  exec 6&gt;&amp;-
  echo &quot;Job completed&quot;
  exit
  </code></pre>
  <p>However, I don't get the desired results.</p>