title: Unix Cat : No such file or directory error
body: <p>I have the following script</p>
  
  <pre><code>#!/bin/bash
  set i=0;
  while read line
  do
    echo "$line";
    $i &lt; cat "my.log" | grep -w '$line' | wc -l;
    echo "$i";
    i=0;
  done &lt; "test.txt"
  </code></pre>
  
  <p><code>test.txt</code> has values like</p>
  
  <pre><code>abc
  def
  lmn
  </code></pre>
  
  <p>my log has values like</p>
  
  <pre><code>&gt; INFO 2013-08-16 13:46:48,660 Index=abc insertTotal=11  
  &gt; INFO 2013-08-16 13:46:48,660 Index=abcd insertTotal=11  
  &gt; INFO 2013-08-16 13:46:48,660 Index=def insertTotal=11  
  &gt; INFO 2013-08-16 13:46:48,660 Index=abcfe insertTotal=11
  </code></pre>
  
  <p>The goal is to pick each value from the <code>test.txt</code> and to search for that pattern in the <code>my.log</code> file.</p>
  
  <p>The number of times the pattern is found is assigned to the variable <code>i</code>.</p>
  
  <p>I am going to check the value of <code>i</code> and if it is <code>0</code> or the pattern was not found then I want that pattern to be stored in another file.</p>
  
  <p>Currently, I am getting</p>
  
  <pre><code>./parser.sh: line 7: cat: No such file or directory
  </code></pre>
  
  <p>I have tried the cat command on the command line and it has worked fine but it is giving this error from within the script.</p>