You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
846 B
Plaintext
43 lines
846 B
Plaintext
4 years ago
|
#!/usr/bin/perl
|
||
|
|
||
|
if (@ARGV != 1) {
|
||
|
print "\n";
|
||
|
print " Usage: $0 <file.track>";
|
||
|
print "\n";
|
||
|
print " generates text files for update_db from\n";
|
||
|
print " the tracking file log.\n";
|
||
|
print "\n";
|
||
|
print " creates <file.track>-is.txt and \n";
|
||
|
print " <file.track>-are.txt\n";
|
||
|
print "\n";
|
||
|
}
|
||
|
|
||
|
foreach $file (@ARGV) {
|
||
|
if (!open IN, $file) {
|
||
|
print "can't open $file: $!\n";
|
||
|
next;
|
||
|
}
|
||
|
|
||
|
open IS, ">$file-is.txt";
|
||
|
open ARE, ">$file-are.txt";
|
||
|
|
||
|
while (<IN>) {
|
||
|
chomp;
|
||
|
if (s/.*?enter: \S+ said \'(.*)\'/$1/
|
||
|
or s/.*?update: \'(.*?)\'; was .*/$1/) {
|
||
|
next if /FAILED/;
|
||
|
if (/^(.*?) is (.*)/) {
|
||
|
print IS "$1 => $2\n";
|
||
|
} elsif (/^(.*?) are (.*)/) {
|
||
|
print ARE "$1 => $2\n";
|
||
|
}
|
||
|
} else {
|
||
|
# do nothing
|
||
|
}
|
||
|
}
|
||
|
|
||
|
close IN;
|
||
|
close IS;
|
||
|
close ARE;
|
||
|
}
|