title: How to grep the outputs of awk, line by line?
body: <p>Let's say I have the following text file:</p>
  
  <p><code>$ cat file1.txt</code> outputs</p>
  
  <pre><code>MarkerName  Allele1 Allele2 Freq1   FreqSE  P-value Chr Pos
  rs2326918   a   g   0.8510  0.0001  0.5255  6   130881784
  rs2439906   c   g   0.0316  0.0039  0.8997  10  6870306
  rs10760160  a   c   0.5289  0.0191  0.8107  9   123043147
  rs977590    a   g   0.9354  0.0023  0.8757  7   34415290
  rs17278013  t   g   0.7498  0.0067  0.3595  14  24783304
  rs7852050   a   g   0.8814  0.0006  0.7671  9   9151167
  rs7323548   a   g   0.0432  0.0032  0.4555  13  112320879
  rs12364336  a   g   0.8720  0.0015  0.4542  11  99515186
  rs12562373  a   g   0.7548  0.0020  0.6151  1   164634379
  </code></pre>
  
  <p>Here is an awk command which prints <code>MarkerName</code> if <code>Pos &gt;= 11000000</code></p>
  
  <pre><code>$  awk '{ if($8 &gt;= 11000000) { print $1 }}' file1.txt 
  </code></pre>
  
  <p>This command outputs the following:</p>
  
  <pre><code>MarkerName
  rs2326918
  rs10760160
  rs977590
  rs17278013
  rs7323548
  rs12364336
  rs12562373
  </code></pre>
  
  <p>Question: I would like to feed this into a <code>grep</code> statement to parse another text file, <code>textfile2.txt</code>. Somehow, one pipes the output from the previous <code>awk</code> command into <code>grep AWKOUTPUT textfile2.txt</code></p>
  
  <p>I would like each row of the awk command above to be <code>grep</code>ped against <code>textfile2.txt</code>, i.e. </p>
  
  <pre><code>grep "rs2326918" textfile2.txt
  ## and then 
  grep "rs10760160" textfile2.txt
  ### and then 
  ...
  </code></pre>
  
  <p>Naturally, I would save all resulting rows from <code>textfile2.txt</code> into a final file, i.e. </p>
  
  <pre><code>$ awk '{ if($8 &gt;= 11000000) { print $1 }}' file1.txt | grep PIPE_OUTPUT_BY_ROW textfile2.txt &gt; final.txt
  </code></pre>
  
  <p>How does one <code>grep</code> from a pipe line by line? </p>
  
  <p>EDIT: To clarify, the one constraint I have is that <code>file1.txt</code> is actually the output of a previous pipe. (I'm trying to simplify the question somewhat.) How would that change the answer? </p>