title: awk issue inside for loop
body: <p>I have many files with different names that end with <code>txt</code>.</p>
  <pre><code>rtfgtq56.txt
  fgutr567.txt
  ..
  </code></pre>
  <p>So I am running this command</p>
  <pre><code>for i in *txt
  do
    awk -F &quot;\t&quot; '{print $2}' $i | grep &quot;K&quot; | awk '{print}' ORS=';' | awk -F &quot;\t&quot; '{OFS=&quot;\t&quot;; print $i, $1}' &gt; ${i%.txt*}.k
  done
  </code></pre>
  <p>My problem is that I want to add the name of every file in the first column, so I run this part:</p>
  <pre><code>awk -F &quot;\t&quot; '{OFS=&quot;\t&quot;; print $i, $1}' &gt; ${i%.txt*}
  </code></pre>
  <p><code>$i</code> means the file that are in the for loop,
  but it did not work because awk can't read the <code>$i</code> in the for loop.
  Do you know how I can solve it?</p>