forked from hmw3/Tips_and_Hacks
50 lines
1.4 KiB
Perl
50 lines
1.4 KiB
Perl
# Mark in Entries_not_handled.txt those Strong's numbers listed in Consistent_Deletes.NT.txt
|
|
|
|
use 5.12.0;
|
|
use File::Slurp;
|
|
$| = "\n";
|
|
use utf8;
|
|
#use open IN => ":utf8", OUT => ":utf8";
|
|
use open IO => ":utf8";
|
|
use File::Find ;
|
|
use FindBin '$Bin';
|
|
use Cwd ;
|
|
|
|
my ($pwd, $d, $textEditor, $repoPath, $browser) = (cwd(), "\\");
|
|
if ($^O eq "darwin" || $^O eq "linux") {$d = "/"}
|
|
|
|
my (@deletes);
|
|
|
|
open LOG, ">:utf8", "$Bin${d}Logs${d}log.log" or die;
|
|
|
|
# my $fileText = read_file("Exceptions${d}Consistent_Deletes.txt", binmode => 'utf8');
|
|
#say LOG $fileText;
|
|
#@deletes = split /\r?\n/, $fileText;
|
|
#say LOG "\@deletes: @deletes";
|
|
|
|
my %obviates;
|
|
say LOG "$Bin${d}Exceptions${d}Consistent_Deletes.NT.txt";
|
|
open IN, ("$Bin${d}Exceptions${d}Consistent_Deletes.NT.txt") or die "$!\n$Bin${d}Exceptions${d}Consistent_Deletes.NT.txt";
|
|
while (<IN>) {
|
|
chomp;
|
|
$obviates{$_} = $_ unless exists $obviates{$_};
|
|
say LOG $obviates{$_};
|
|
}
|
|
close IN;
|
|
|
|
my $fileText = read_file("$Bin${d}Output${d}Entries_not_handled.txt", binmode => 'utf8');
|
|
#foreach my $thisNo (@deletes) {
|
|
# $fileText =~ s/(\t$thisNo)(\r?\n)/$1\t||$2/g;
|
|
#}
|
|
foreach my $thisNo (sort keys %obviates) {
|
|
$fileText =~ s/(\t$obviates{$thisNo})(\r?\n)/$1\t||$2/g;
|
|
}
|
|
|
|
say LOG "$Bin${d}Output${d}Entries_not_handled.txt";
|
|
open OUT, ">$Bin${d}Output${d}Entries_not_handled.txt" or die;
|
|
say OUT $fileText;
|
|
close OUT;
|
|
|
|
close LOG;
|
|
|
|
say "Done." |