in reply to Faster grep in a huge file(10 million)
If your 12 million records average less than a couple of kbytes each (ie. if the size of the records file is less than your available memory), I'd just load the entire file into memory as a single string and the read the circuits file one line at a time and use index to see if it is in the records:
#! perl -slw use strict; my $records; { local( @ARGV, $/ ) = $ARGV[0]; $records = <>; } open CIRCUITS, '<', 'circuits' or die $!; while( <CIRCUITS> ) { unless( 1+ index $records, $_ ) { print; } } __END__ C:\test>1033014 records circuits >notfound
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Faster grep in a huge file(10 million)
by educated_foo (Vicar) on May 12, 2013 at 12:50 UTC | |
by BrowserUk (Patriarch) on May 12, 2013 at 15:04 UTC |