This is the script I have so far.
#!/usr/bin/perl -w
use strict;
use warnings;
use Text::ParseWords;
use POSIX qw/strftime/;
use Excel::Writer::XLSX;
my $dir = "/home/vlr/archive/";
my $date = "20211201";
# Check directory for relevant files
opendir(DIR, $dir) or die "Could not open ".$dir."\n";
my @dir = grep(/^USRINF.*.$date.*.1700.txt$/, readdir DIR);
closedir DIR;
my %btssec;
foreach $_(sort @dir){
my $DFile = $dir.$_;
print "Processing: ".$DFile."\n";
# Open Data File and parse each line
open my $DF, '<', $DFile or die "Can't open $DFile $!";
foreach $_ (<$DF>){
chomp( $_ );
if((length $_ > 0)&&($_ =~ /^\d{15}/)){
$_ =~ s/\s+/;/g;
my($imsi,$mdn,$sec) = (quotewords('[\t;]+|,\s', 0, $_))[0,
+1,3];
if((($imsi =~ /^\d{15}/)&&($imsi =~ /^(702|310)/))&&(($mdn
+ =~ /^\d{10}/)&&($mdn =~ /^(501)/))){
#print $imsi.",".$mdn.",".$sec."\n";
=pod # The part below is the part of the script I need help with to p
+rocess the parsed data whose output I'm posted as the snippet to proc
+ess.
if(!exists($btssec{$sec})){
print "New key:" . $sec ."\n";
$btssec{$sec} = $mdn;
}elsif(exists($btssec{$sec})){
#push( @{$btssec{$sec}}, $mdn );
}
=cut
}
}
}
close $DF;
print "$_\n" for keys %btssec;
}
For now, the script I have in POD sucks it's not doing what I thought it would do. (sigh).