Awk print every line x3 times?
<p>With this awk one-liner 
<code>awk '{lines[NR]=$0}{for(i=0;i&lt;3;i++) print $lines[i]}</code>  awk.write</p>

<p>awk.write </p>

<pre><code>this line 1 no un1x
this lines 22 0
butbutbut this 33 22 has unix
but not 1
THIS is not
butbutbut ffff
second line
</code></pre>

<p>printed as</p>

<pre><code>this line 1 no un1x
this line 1 no un1x
this line 1 no un1x
this lines 22 0
this lines 22 0
this lines 22 0
butbutbut this 33 22 has unix
butbutbut this 33 22 has unix
butbutbut this 33 22 has unix
but not 1
but not 1
but not 1
THIS is not
THIS is not
THIS is not
butbutbut ffff
butbutbut ffff
butbutbut ffff
second line
second line
second line
</code></pre>

<p>However, it seems there is use of <code>$</code> working differently over-here, as without it running <code>lines[i]</code> i get </p>

<pre><code>this line 1 no un1x


this line 1 no un1x
this lines 22 0

this line 1 no un1x
this lines 22 0

this line 1 no un1x
this lines 22 0

this line 1 no un1x
this lines 22 0

this line 1 no un1x
this lines 22 0

this line 1 no un1x
this lines 22 0
</code></pre>

<p>The point being <code>lines[0]</code> returns empty results when the same run with <code>$lines[i]</code> it outputs as above shown in <code>printed as</code> section. Is there no better way of doing this I don't like use of <code>$</code> in this regard. Thanks.</p>