Fellow monks,

I have a question, I am wondering how to take 2 different files each having a unique hash key, which we will call $login, which is at the beginning of the line, and that key on each line is the only thing about them that is the same, take line by line or by iteration the contents of the first one add the contents of the second one after the key to the end of the first files line contents, per unique key, and kick out a third file which is in this format line by unique key line:

unique $login:$info from first file:info from second file another unique $login:info from first file:info from second file yet another unique $login:first file contents:second file contents ...........
or just take the first file contents add the second file contents -minus the $login add the contents to the end of the firsts and produce a third.

Thanks.

edited: Wed Nov 5 23:03:25 2003 by jeffa - code tags, p tags


In reply to compare 2 files and print to a third by tux242

Title:
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, details, 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, summary, 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.