reading line by line from text file and output to array bash
<p>I'm trying to read lines from a .txt and copy each line from the text to its own folder that was previously created with ARRAY</p>

<pre><code>cat stores/locations.txt |while read -r LINE;do 
echo "$LINE" &gt; county/${ARRAY[${i}]}/localstores.txt
done
</code></pre>

<p>when I run this it creates only 1 file in the directory county with one line of contact information for the store but what i really want it to do is to put a file in each element of the ARRAY instead of the parent folder county.</p>

<p>each line of data includes the following:</p>

<pre><code>&lt;storeid&gt; &lt;storename&gt; &lt;amountofEmployees&gt; &lt;nameofManager&gt;
</code></pre>

<p>I'm super stuck and really would appreciate the help!</p>