in reply to Re: Are two lines in the text file equal
in thread Are two lines in the text file equal

Any key with a count > 1...

...might just have appeared in one file more than than once but never the other.

my $log1 = '/var/log/httpd/acce­ss_log'; my $log2 = '/var/log/httpd/acce­ss_log.1'; my %hash; open FH, $log1 or die $!; $hash{$_}++ while <FH>; close FH; open FH, $log2 or die $!; while( <FH> ) { print if $hash{$_}; } close FH;

At least, that is how I interpret the question.

Update: BrowserUk has more singular words than I have plural words to go on and so is probably right. It appears tachyon also thought two files were involved, so I won't feel too bad.

                - tye

Replies are listed 'Best First'.
Re: Re^2: Are two lines in the text file equal (!count)
by BrowserUk (Patriarch) on Nov 13, 2003 at 03:09 UTC

    Am I the only one who interprets this question to relate to finding duplicates in a single file?

    ...a given text file....anywhere in the file...The file contains...

    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    Hooray!
    Wanted!

      Yes, the goal is to find the duplicated (triplicates??) if any. Unfortunately, the machine with 1-4 GB is not at my disposal, so generating a giant hash is not truly an option.
        You know you keep saying that, but it's not true (you don't need a machine with 1-4GB ), just use DB_File.

        MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
        I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
        ** The third rule of perl club is a statement of fact: pod is sexy.