 <p>I would suggest doing the whole thing in awk, rather than using a shell loop:</p> <pre><code>awk '{for (i=1; i&lt;=12; ++i) printf "%d%s", $1+i, (i&lt;12?FS:RS)}' "$f1" &gt; output </code></pre> <p>This loop runs for each line of the file and outputs all of the columns, saving the need to use another tool such as <code>paste</code>. The ternary operator is used to output a space (<code>FS</code>) between each column and a newline (<code>RS</code>) at the end of the line.</p> <hr> <p>For the second part of your question, you can still do most of the work in awk.</p> <pre><code>declare -A companies companies=( [company1]=10 [company2]=25 [company3]=50 ) for c in "${companies[@]}"; do awk -v bonus="${companies[c]}" '{for (i=1; i&lt;=12; ++i) printf "%d%s", $i+(i==1||i==5||i==9?bonus:5), (i&lt;12?FS:RS)}' "$f1" &gt; "$c.txt" done </code></pre> <p>I have created an associative array containing each company name and their bonus. The loop goes through each company in the array, passing the bonus to awk as a variable (note that I'm doing this using <code>-v</code> rather than using string concatenation). The loop goes from 1 to 12, adding the bonus for months 1, 5 and 9, or 5 otherwise. The name of the company (the key of the shell array) is used for the output file.</p>