-
Notifications
You must be signed in to change notification settings - Fork 0
/
Check_Canada.pl
executable file
·70 lines (58 loc) · 1.71 KB
/
Check_Canada.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/perl -w
use strict;
use diagnostics;
my $Source=$ARGV[0];
#my $Source="/opt/log/atg/2014/03/13512/sm";
my @Files;
my $Verbose="F";
my $Loop; my $Tail;
my %Visited;
my %Canada = (
# 204 => 'TestingSite',
218 => 'Winnipeg',
217 => 'Swift Current',
198 => 'Calgary',
214 => 'Kelowna',
225 => 'Port Hardy',
216 => 'Prince Rupert',
226 => 'Greely',
215 => 'Toronto',
243 => 'Quebec',
xxx => 'Strathroy',
229 => 'International Falls',
66 => 'Broadview',
224 => 'Chapleau'
);
#print "Checking Sites:\n";
#foreach $Loop ( sort ( keys ( %Canada ) ) ) {
# print "\$Canada{$Loop} :$Canada{$Loop}:\n";
#}
(undef, undef, undef ,undef, undef, undef, $Tail, undef)=split('/', $Source);
chdir($Source);
open(FILES, "ls -1 $Source | grep SM.tar.gz |");
while(<FILES>) {
chomp;
push(@Files, $_);
}
foreach $Loop (@Files) {
open(INPUT, "/bin/tar xzvOf $Loop \"*_Airlink.txt\" 2>/dev/null |");
while(<INPUT>) {
chomp;
next unless ( /SectorID, \d\d \d\d \d\d \d\d \d\d/ );
#Serving_SectorID, 00 00 00 00 00 00 00 00 00 00 00 00 00 02 19 00
#Serving_SectorID, 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 00
#Serving_SectorID, 00 00 00 00 00 00 00 00 00 00 00 00 00 01 81 04
#Serving_SectorID, 00 00 00 00 00 00 00 00 00 00 00 00 00 00 27 04
$_ =~ /Serving_SectorID, \d\d \d\d \d\d \d\d \d\d \d\d \d\d \d\d \d\d \d\d \d\d \d\d \d\d (\d\d) (\d\d) (\d\d)/;
my $Cell1=$1;
my $Cell2=$2;
my $Cell="$1"."$2";
$Cell =~ s/^0+//;
my $Sector=$3;
#my $SectorLine = ", Cell $Cell, Sector $Sector";
$Visited{$Cell}="Tail $Tail has used site $Cell - $Canada{$Cell}" if ( $Canada{$Cell} );
}
}
foreach $Loop ( sort ( keys ( %Visited ) ) ) {
print "$Visited{$Loop}\n";
}