title: read values of txt file from bash
body: <p>I'm trying to read values from a text file.</p>
  
  <p>I have test1.txt which looks like</p>
  
  <pre><code>sub1    1   2   3
  sub8    4   5   6
  </code></pre>
  
  <p>I want to obtain values '1 2 3' when I specify 'sub1'.</p>
  
  <p>The closest I get is:</p>
  
  <pre><code>subj="sub1"
  grep "$subj" test1.txt
  </code></pre>
  
  <p>But the answer is: </p>
  
  <pre><code>sub8    4   5   6
  </code></pre>
  
  <p>I've read that grep gives you the next line to the match, so I've tried to change the text file to the following:</p>
  
  <p>test2.txt looks like:</p>
  
  <pre><code>sub1    
  1   2   3
  
  sub8    
  4   5   6
  </code></pre>
  
  <p>However, when I type</p>
  
  <pre><code>grep "$subj" test2.txt
  </code></pre>
  
  <p>The answer is:</p>
  
  <pre><code>sub1
  </code></pre>
  
  <p>It should be something super simple but I've tried awk, seg, grep,egrep, cat and none is working...I've also read some posts somehow related but none was really helpful</p>