Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hi Guys

I know that I am meant to show my working however I have none because I cannot find anywhere that can help me with this issue, so I have come to you (the monks) cap in hand to plead for your help.

I have 2 files which have a common field that need to be joined together.
File1: 70000004 12008401 70000005 52003402 70000007 17527802 70000008 95050962 70000011 50010101 70000012 17576901 70000013 07072701 70000014 52010201 70000015 35555501 70000017 53561503 70000018 40500304 70000019 35513607 70000021 41548701 70000022 54644601 70000022 95050682 File2: 70000004 00 70000005 25 70000007 25 70000008 31 70000008 31 70000009 34 70000010 21 70000011 21 70000012 17 70000013 47 70000014 19 70000015 43 70000017 20 70000018 15 70000019 11
As you can see with the data, there are some fields in file 2 that are not in file1, I need to be able to join both of the second fields together to form a new .csv in this format.
The key fields (field 1 in both files) are to be removed after merging as they are no longer required. Any entries that do not match file1 are to be removed. I looked at just pasting the files together but it is too clumsy for what I need to achieve.

If someone could please help as I am at my wits end



In reply to Merge 2 files using key field by Jalcock501

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (10)
    As of 2018-06-18 16:42 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (110 votes). Check out past polls.