title: How can I use sed (or awk or maybe a perl one-liner) to get values from specific columns in file A and use it to find lines in file B?
body: <p>OK, sedAwkPerl-fu-gurus.  Here's one similar to these (<a href="https://stackoverflow.com/questions/10487531/extract-specific-strings-from-line-in-file-and-output-to-another-file-with-modif">Extract specific strings...</a>) and (<a href="https://stackoverflow.com/questions/12182910/using-awk-to-pull-specific-lines-from-a-file">Using awk to...</a>), except that I need to use the number extracted from columns 4-10 in each line of File A (a PO number from a sales order line item) and use it to locate all related lines from File B and print them to a new file.</p>
  
  <p>File A (purchase order details) lines look like this:</p>
  
  <pre><code>xxx01234560000000000000000000 yyy zzzz000000
  </code></pre>
  
  <p>File B (vendor codes associated with POs) lines look like this:</p>
  
  <pre><code>00xxxxx01234567890123456789001234567890
  </code></pre>
  
  <p>Columns 4-10 in File A have a 7-digit PO number, which is found in columns 7-13 of file B.  What I need to do is parse File A to get a PO number, and then create a new sub-file from File B containing only those lines in File B which have the POs found in File A.  The sub-file created is essentially the sub-set of vendors from File B who have orders found in File A.</p>
  
  <p>I have tried a couple of things, but I'm really spinning my wheels on trying to make a one-liner for this.  I could work it out in a script by defining variables, etc., but I'm curious whether someone knows a slick one-liner to do a task like this.  The two referenced methods put together ought to do it, but I'm not quite getting it.</p>