#!/usr/bin/perl use Getopt::Long; &GetOptions('date=s' => \$date, 'dir=s' => \$directory, 'help' => \$help); if ( defined $help ) { usage(); } unless ( defined $date ) { usage(); } ####################################### # Declaring my variables below for # # the script # ####################################### my $PATH = "/Ack/$date/"; my $ID; my $TRANSPORT; my $ftpoutbound = "/homes/ftpoutbound.db"; my %count; my @id; my $temp; opendir (DIR, $PATH) || die print "can't open dir $PATH at line 62 : $!\n"; my @FileList = readdir(DIR); close (DIR); foreach $FileList(@FileList) { if ( ($FileList eq ".") || ($FileList eq "..") ) { next; } else { chomp $FileList; open (FILE, "$PATH$FileList") or die ("can't open $PATH$FileList :$!\n"); @LINES=; close FILE; foreach $LINES(@LINES) { @Fields = split (/[\|\*~]/, $LINES); if ( $Fields[5] =~ /^ZZ$/ ) { $ID = $Fields[6]; push (@id, $ID); } } } } $count{$_}++ for @id; print "$_ => $count{$_}\n" for keys %count; %temp = (); @id = grep ++$temp{$_} < 2, @id; open (File, "$ftpoutbound") or die ("can't open $ftpoutbound at line ** : $!\n"); @FTP_Lines=; close File; foreach $id(@id) { $id =~ s/\s+//; foreach $FTP_Lines(@FTP_Lines) { chomp $FTP_Lines; @FTP_fields = split (/\;/, $FTP_Lines); if ( $FTP_fields[0] eq $Clec_id ) { $TRANSPORT = $FTP_fields[7]; #print "C => $id and TRANSPORT => $TRANSPORT\n"; } } print ("$id uses $TRANSPORT as transport\n"); } # help/usage message and exits sub usage { print "Usage: \n"; print "This program requires one argument, w/ an optional help argument.\n"; print "Options should be specified as follows: \n"; print "--date REQURIED Takes in the mmddyyyy format only\n"; print "--help OPTIONAL Prints this message.\n"; print "example: ./TransactionsPerDay.pl --date 09152003 \n"; exit(1); } #### RHYTHMSIAVZSP => 117 ALGXSOULSOG5 => 1 SPNTVRZPRD => 69 2037721000SORD => 1 NEXTXOVENORDIAP => 5 VZEAPIPO => 27 VZELFLPO => 2 SGWEASTPROD => 41 TALKLSOG5 => 406 VZAPRODBAN => 21 gntftp5p => 98 NVEECIPO => 3 NVEDLCPO => 15 NVEIGCPO => 6 VZAPRODBAS => 24 VORDBAN2 => 234 VORDBAN2 uses SSL as transport COVADVZESORDP uses yes as transport ASHEESH uses yes as transport VORDBAS2 uses SSL as transport CMSTVZEORDP uses SSL as transport RHYTHMSIAVZSP uses SSL as transport TALKLSOG5 uses SSL as transport COVADVZENORDP uses yes as transport DSLNETBANORD uses yes as transport #### RHYTHMSIAVZSP 12 SSL COVADVZ 245 yes ATT 33 NDM