title: grep on one file and sort matches to several output files
body: <p>my question concerns the following:
  I have the file:</p>
  
  <pre><code>    FileA:
  Peter Programmer
  Frank Chemist
  Charles Physicist
  John Programmer
  Alex Programmer
  Harold Chemist
  George Chemist
  </code></pre>
  
  <p>I now got all the job information from FileA and saved it to a unique list (FileB).</p>
  
  <pre><code>  FileB:
  Programmer
  Chemist
  Physcist
  </code></pre>
  
  <p>(Assume the FileA goes on and on with many more people and redundant information)</p>
  
  <p>What I want to do now is get all the job classes from FileA and create a new file for each Job-Class so that in the end I have:</p>
  
  <pre><code>FileProgrammer
  Peter Programmer
  John  Programmer
  Alex  Programmer
  
  FileChemist
  Frank Chemist
  Harold Chemist
  George Chemist
  
  FilePhysicist
  Charles Physicist
  </code></pre>
  
  <p>I want to <code>grep</code> the pattern of the job name from the list in the Jobs File and create a new file for every job name which exists in the other original file.</p>
  
  <p>So in reality, I have 56 Unique Elements in my list and the original file has several columns ( tab delimited).</p>
  
  <p>What I did so far was this:</p>
  
  <pre><code>cut -f2 | sort | uniq &gt; Jobs
  grep -f(tr '\t' '\n' &lt; "${Jobs}") "${FileA}" &gt; FileA+"${Jobs}"
  </code></pre>
  
  <p>I assumed that on each new pattern match a new file would be created but I realized that it would just copy the file because there is no increment or iterative file creation.</p>
  
  <p>Since my experience with bash is yet to be developed in depth, I hope you guys can help me. Thanks in advance.</p>
  
  <p>@update:
  Input file looks like this:</p>
  
  <pre><code>4   23454   22110   Direct  +   3245    Corrected
  3   21254   12110   Indirect    +   2319    Paused-@2
  11  45233   54103   Direct  -   1134    Not-Corrected
  </code></pre>
  
  <p>Essentially, I want everything that has the status in column 7 of Corrected to be in a file named corrected and so for every unique value of column 7.</p>