forked from unfoldingWord/en_tw
39 lines
1.0 KiB
Perl
39 lines
1.0 KiB
Perl
# Combines most recent ULB with KJV with codes.
|
|
|
|
use 5.12.0;
|
|
|
|
my ($ulb, $nasb) = ("/Users/Henry/Google Drive/WA/Test/Unlocked Bible/ULB text.txt", "/Users/Henry/Google Drive/WA/Test/data/NASB.Strongs.txt");
|
|
my ($ref, $val);
|
|
my (%codes);
|
|
|
|
open LOG, ">:utf8", "/Users/Henry/Google Drive/WA/Test/out/log.log" or die;
|
|
open OUT, ">:utf8", "/Users/Henry/Google Drive/WA/Test/data/ULB.NASB.Strongs.txt" or die;
|
|
|
|
open (my $file, "<:utf8", "$nasb") or die "$nasb:\n$!";
|
|
|
|
while (my $line = <$file>) {
|
|
chomp $line;
|
|
if ($line =~ /^([^\t]*)\t(.*)$/) {
|
|
($ref, $val) = ($1, $2);
|
|
$codes{$1} = $2;
|
|
}
|
|
}
|
|
|
|
|
|
open ($file, "<:utf8", "$ulb") or die "$ulb:\n$!";
|
|
|
|
while (my $line = <$file>) {
|
|
chomp $line;
|
|
if ($line =~ /^([^\t]*)\t(.*)$/) {
|
|
($ref, $val) = ($1, $2);
|
|
if (exists $codes{$ref}) {
|
|
say OUT "$ref\t$val\n $codes{$ref}"
|
|
}
|
|
}
|
|
}
|
|
|
|
close OUT;
|
|
close LOG;
|
|
|
|
system 'open -a /Applications/BBEdit.app "/Users/Henry/Google Drive/WA/Test/data/ULB.NASB.Strongs.txt"';
|
|
print "\n\tDone\n\n\tOutput is in /Users/Henry/Google Drive/WA/Test/data/ULB.NASB.Strongs.txt\n\n"; |