Honored Contributor Honored Contributor
Re: Script help. Perl perhaps ?
Yes, in this case, perl would be extremely faster.

--8<---
#!/usr/bin/perl

use strict;
use warnings;

my $masterfile = "/tmp/masterfile";
my $datafile = "/tmp/datafile";

open my $out, ">", "luke.out" or die "luke.out: $!\n";

my %master;
open my $mst, "<", $masterfile or die "$masterfile: $!\n";
while (<$mst>) {
my @mst = split /\|/, $_;
$master{join "|", @mst[1,4,5]} = [ @mst[0,2,6] ];
}
close $mst;

open my $dta, "<", $datafile or die "$datafile: $!\n";
while (<$dta>) {
my @dta = split /\|/, $_;
my $cmp = join "|", @dta[1,4,5];
exists $master{$cmp} or next;

my $id = $master{$cmp}[0];
print $out "$id|$dta[2]|$dta[6]\n";
}
close $dta;
close $out;
-->8---

You could even gain a lot more speed if you told us the format of the fields, and change the join "|"'s to pack.

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn