$fileArray;
my $totlogfile = "$today-TotalLogFile";
my $totlogfile1 = "today-TotalLogFile1";
my $totlogfilebkup="TotalLogFileBkup";
open(total,">$totlogfilebkup") || die("Could not open out file!$outfil
+e");#outfile is declared before
opendir(DIR, "logfiles") or die "couldn't open logs";
while ( defined ($filename = readdir(DIR)) )
{
$index = index($filename,$yesterday);
if ($index > -1)
{
$fileArray[$count] = $filename;
$count = $count + 1;
print "The log file name is $filename.\n";
open(logfile,"$filename") || die("Couldx not ope
+n file! $logfilename");#$logfilename declared
while($line = <logfile>)
{
chomp($line);
unless(( $line =~ /\.gif/i ) || ( $line =~
+ /\.jpg/i ) || ( $line =~ /\.jpeg/i ) || ( $line =~ /\.js/i ) || ( $l
+ine =~ /\.css/i ) || ( $line =~ /tickerServlet/i ) || ( $line =~ /nag
+ios/i ) || ( $line =~ /statusservlet/i ))
{
print total "$line\n";
+
}
}
close logfile;
}
}
closedir(DIR);
close total;
My file will have lines as follows
3.77.65.36 - -
16/Jan/2005:00:01:08 -0500 "GET /images/spacer.gif HTTP/1.0" 200 43 0 "-" "Mozilla/3.01 (compatible;)" "-"
3.45.14.157 - -
16/Jan/2005:00:02:22 -0500 "HEAD /portal/site/energy/ HTTP/1.1" 200 - 0 "-" "libwww-perl/5.11" "-"
Lines similar to the above.
I want line 2 but not line 1 coz it has gif.
Thanks
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.