Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Indexing two large text files

by bimleshsharma (Beadle)
on Apr 09, 2012 at 13:29 UTC ( #964125=note: print w/replies, xml ) Need Help??

in reply to Indexing two large text files

ok, you can put those lines into temp file and after indexing over you can replace file1 with temp file. For example:

While<file1> { $f1=$_; While<file1> { $f2= $_; if($f1 eq $f2) { print TF "$f2\n"; } } print TF "$f1\n"; } close TF; open F_1,"file1.txt"; while(<F_1>) { print F_1 "$_\n"; } close F_1;

Replies are listed 'Best First'.
Re^2: Indexing two large text files
by never_more (Initiate) on Apr 09, 2012 at 13:48 UTC
    Thanks bimleshsharma, but even writing to a file, the complexity is still O(N**2)? and when I reach the end of file2, I think I still need to move file2's handler to the beginning of file2?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://964125]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2017-06-26 21:38 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (594 votes). Check out past polls.