Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2016-09-30 10:41 GMT
Find Nodes?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:

    Results (563 votes). Check out past polls.