E
ExecMan
Hi,
I have a file containing URL's, and I am trying to scan a log and get
a count of the matching string. But, I think because the input
contains slashes I am not getting a match. Any help please?? I'm
pretty new to this:
#!/usr/bin/perl
open (FILE,"monday.csv") or die $!;
while(<FILE>) {
chomp($_);
($tag, $url) = split(',', $_);
$url_tags{$tag} = $url;
$url_counts{$tag} = 0;
}
close(FILE);
open (FILE,"<","/home/httpdlogs/apache2/access_log") or die "Can't
open apache log!";
foreach $tag (keys(%url_tags)) {
$url = $url_tags{$tag};
$count = grep { /$url/ } <FILE>;
$url_counts{$tag} = $count;
}
close(FILE);
The $url contains slashes, how can I get around this??
I have a file containing URL's, and I am trying to scan a log and get
a count of the matching string. But, I think because the input
contains slashes I am not getting a match. Any help please?? I'm
pretty new to this:
#!/usr/bin/perl
open (FILE,"monday.csv") or die $!;
while(<FILE>) {
chomp($_);
($tag, $url) = split(',', $_);
$url_tags{$tag} = $url;
$url_counts{$tag} = 0;
}
close(FILE);
open (FILE,"<","/home/httpdlogs/apache2/access_log") or die "Can't
open apache log!";
foreach $tag (keys(%url_tags)) {
$url = $url_tags{$tag};
$count = grep { /$url/ } <FILE>;
$url_counts{$tag} = $count;
}
close(FILE);
The $url contains slashes, how can I get around this??