forked from WycliffeAssociates/en_tw
36 lines
868 B
Perl
36 lines
868 B
Perl
use 5.12.0;
|
|
use File::Slurp;
|
|
use File::Find ;
|
|
use Cwd ;
|
|
use utf8;
|
|
#use open IN => ":utf8", OUT => ":utf8";
|
|
use open IO => ":utf8";
|
|
|
|
my $book;
|
|
my @bookList;
|
|
|
|
open (my $file, "<:utf8", "/Users/Henry/Google Drive/WA/Test/data/tW.work.dat") or die "$/Users/Henry/Google Drive/WA/Test/data/tW.work.dat:\n$!";
|
|
|
|
while (my $line = <$file>) {
|
|
chomp $line;
|
|
if ($line =~ /^([^#][^\t\n]*)\t([^\t\n]*)\t[^\t\n]*$/) {
|
|
$book = "$1";
|
|
push @bookList, $book;
|
|
}
|
|
}
|
|
|
|
close $file;
|
|
|
|
|
|
say "Removing old Extract.txt";
|
|
|
|
system `rm \"/Users/Henry/Google Drive/WA/Test/Unlocked Bible/Extract.txt\"`;
|
|
|
|
say "Grepping the list of books.";
|
|
|
|
foreach $book (@bookList) {
|
|
say $book;
|
|
system `grep \"^$book [0-9]*:[0-9]*.*$\" \"/Users/Henry/Google Drive/WA/Test/Unlocked Bible/ULB text.txt\" >> \"/Users/Henry/Google Drive/WA/Test/Unlocked Bible/Extract.txt\"`;
|
|
}
|
|
|
|
say "Done." |