in reply to Re: Comparing files
in thread Comparing files

If count == 30, you know that particular address was found in all 30 files...
Almost. If count == 30, you know that the MAC showed up 30 times in the combined input. Could've been 30 times in the first file. If, however the OP knows that the MACs are unique within a given file (i.e. each MAC in a file appears only once), then the statement that "count == 30 implies it was found in all 30 files" is true.

thor

Replies are listed 'Best First'.
Re^3: Comparing files
by davido (Cardinal) on Jul 19, 2004 at 22:27 UTC

    Good grief. Ok, well, if each file could contain the same mac address more than once, use a second hash to guarantee uniqueness per file. Or another approach would be to start with file one. Put all of its mac addresses into a hash, as keys. Then open file two. Delete any hash keys that aren't found in file two. Open file three. Delete any remaining hash keys that aren't found in file three. And so on... you get the idea. What's left at the end is your list of mac addresses that exist in all 30 files.


    Dave

      davido, I like your idea on how to do this. My questions are. How do you read a file into just the hash keys? How would I code, deleting hash keys from file1 that are not found in file2. Thanks

        Since I don't want to do your script writing for you from start to finish, I'll just ask, what are you specifically stuck on?

        Is it...

        If you're close on something that you just need a little help with we're all here for you. But as mentioned before, don't try to struggle with all this if you're not "there yet". If you're not even close, take a step back, and tackle the more rewarding project of reading "Learning Perl." It's a great book, published by O'Reilly & Associates. You'll recognize it by the Llama on its cover and the light blue book spine. Pretty much everything you're asking is covered in that book. But without a basic understanding of Perl, as taught by a book like that, or by studying the online Tutorials and the Perl POD, you're going to have a difficult time writing the script.


        Dave