diamondsandperls has asked for the wisdom of the Perl Monks concerning the following question:
my @textfiles = <*.txt *.log>; my $input_file; my $input_fh; my $src; my $dst; my $output_file = "simon.csv"; open(my $output_fh, '>', $output_file) or die "Failed to open $output_file - $!"; print {$output_fh} "uploadfiles,submitter,description,SIP,DIP, +Date_occurred_detected,Time_occurred_detected,Report_Severity,Inciden +t_Type_Details\n"; close $output_fh; foreach my $textfile (@textfiles) { if ($textfile =~ /(\d+.\d+.\d+.\d+)/) { my $ipaddy = $textfile =~ /(\d+.\d+.\d+.\d+)/; print "Processing $textfile\n"; open(my $input_fh, '<', $textfile) or die "Failed to open $textfile: $!"; open($output_fh, '>>', $output_file) or die "Failed to open $output_file - $!"; while (my $line = <$input_fh>) { if ($line =~ /\d{4}-\d+-\d+\s\d{2}:\d{2}:\d{2}\s\d+\s\d+.\d+.\ +d+.\d+/) { $src = $line =~ /\d{4}-\d+-\d+\s\d{2}:\d{2}:\d{2}\s\d+\s(\ +d+.\d+.\d+.\d+)/; print {$output_fh} "$1.zip,$newcontent,Malicious activity +found when mining proxylog data,$1,"; $dst = $line =~ /SG-HTTP-Service (\d+.\d+.\d+.\d+)/g; print {$output_fh} "$1,$now_Month\/$now_Day\/$now_Year,$no +w_Hour:$now_Min $am_pm2,3,24\n"; } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: correct angle on tackling a problem
by MidLifeXis (Monsignor) on Aug 24, 2012 at 18:39 UTC | |
by diamondsandperls (Beadle) on Aug 24, 2012 at 19:03 UTC | |
by roboticus (Chancellor) on Aug 24, 2012 at 22:43 UTC | |
|
Re: correct angle on tackling a problem
by cheekuperl (Monk) on Aug 24, 2012 at 17:52 UTC | |
by diamondsandperls (Beadle) on Aug 24, 2012 at 18:03 UTC | |
by MidLifeXis (Monsignor) on Aug 24, 2012 at 18:35 UTC |