#!/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); }