in reply to Re^3: Get data from a file to search and replace within a second file
in thread Get data from a file to search and replace within a second file
my ($fa, $fb) = @ARGV; open IN, $fa or die $!; my %h; while (<IN>) { my ($str, $rep) = (split)[2,3]; $h{$str} = $rep; } my $pat = join '|', map { quotemeta $_ } keys %h; $pat = qr/\b($pat)\b/; print STDERR "$pat\n"; open IN, $fb or die $!; while (<IN>) { s/$pat/$1$h{$1}/g; print; }
|
|---|