Hello all,

I need help with comparing files.

What I have is 30 files full of Mac Addresses.

I need to find the Mac Addresses that show up in all 30 files and output them to a new file.

The files are listed in an @all. Actually here is what I got so far.

$all=qx/ls \/export\/home\/*_01day @all1=split("\n",$all); for(@all1){push(@all2,(split(' ',$_)));} @all3 = reverse(@all2); @all4 = (@all3[0..29]);

So what is left is @all4 holds the 30 file names of the files I need to compare. Now im stuck. How do I go about opening and comparing these files to output the Mac addresses that show up in all 30 files to a new file.

Thanks.

20040720 Edit by castaway: Changed title from 'Help with Perl Script'


In reply to Comparing files by dannyp

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.