Dear Monks, I don't even know where to begin this one. Basically, I have four files, file6, file8, file11 and file13. Below I have a sample of the content of the files.

file6
abc-def 2000 abc-def 2007
file13
abc-def 3 abc-def 95 abc-def 1300 abc-def 2000 abc-def 2001 abc-def 2002
file8
abc-def 2000 sometext abc-def 2000 sometext abc-def 2007 sometext abc-def 2007 sometext
file11
abc-def 2000
What I need to do is find duplicate entries between file6 and file13 (already done, shown in file11), and replace that number in file8 with a number from a pre-defined range that is not used in file13. I'm not sure if I even need to pull the duplicate numbers into a separate file or not. Also, the 'abc-def' string does stay the same in all files.
I know I've posted a few questions on here before, but I'm new to perl and am trying to learn on the fly. Any ideas would be greatly appreciated.

In reply to replace data based on duplicate in another file by ddrew78

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.