-
Notifications
You must be signed in to change notification settings - Fork 0
/
linecheck.pl
38 lines (34 loc) · 1020 Bytes
/
linecheck.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/perl
use strict;
use warnings;
if ($#ARGV != 1) {
print "Usage: linecheck.pl ARG1 ARG2\nWhere ARG1 and ARG2 are of the form \"(YYY|YNY|YNN|YYN|NNY|NNN|ABAIRT|ABAIRT-CH)\"\n";
exit 1;
}
binmode STDOUT, ":encoding(iso-8859-1)";
binmode STDERR, ":encoding(iso-8859-1)";
binmode STDIN, ":bytes";
my $foinse0="/snapshot/aimsigh/$ARGV[0]";
my $foinse1="/snapshot/aimsigh/$ARGV[1]";
my $tot=0;
opendir DIRH, $foinse0 or die "could not open $foinse0: $!\n";
foreach my $doctxt (readdir DIRH) {
next if $doctxt !~ /\.txt$/;
my $c1 = 0;
my $c2 = 0;
open (FIRST, "<", "$foinse0/$doctxt") or die "Could not open $doctxt in $foinse0\n";
while (<FIRST>) {
$c1++; # if m/^<DOC>$/;
}
close FIRST;
open (SECOND, "<", "$foinse1/$doctxt") or die "Could not open $doctxt in $foinse1\n";
while (<SECOND>) {
$c2++; # if m/^<DOC>$/;
}
close SECOND;
print "Problem with $doctxt ($c1,$c2)...\n" if ($c1 != $c2);
# print "No problem with $doctxt ($c1,$c2)...\n" if ($c1 == $c2);
$tot++;
}
closedir DIRH;
exit 0;