split log file

2001-07-10 Thread Katie Elliott

Hi,
I am trying to split apart a log file.  However, it doesn't seem to be working.  Can 
anyone give me some help?  I am still trying to figure out how split works.  It seems 
to work up to the browser, but after that I seem to be having trouble.

Thanks in advance,
Katie
---
ipaddr - user [dd/Mon/:hh:mm:ss -offset] "METHOD URI HTTP/1.x" respcode bytes 
"referrer" "browser" METHOD REQUEST "HTTP/1.x" cookie1=value1

'^(\S+) (\S+) (\S+) \[(\d\d)\/(\S\S\S)\/(\d\d\d\d):(\d\d):(\d\d):(\d\d) (\S+)\] 
\"(\S+) ([^"]*)\" (\S+) (\S+) \"?(
[^"]*)\"\s*\"([^"]*)\" (\S+) ([^"])\" (\S+)'
__
Get your own FREE, personal Netscape Webmail account today at 
http://webmail.netscape.com/



date:calc

2001-06-28 Thread Katie Elliott

Hi,
Can you tell me if Date:Calc is the best way for calcuating dates?  I would like to 
pass specific dates to analog to do log file analysis on the dates.  

Here are my scripts:
1)Previous Month
#!/usr/bin/perl

use Date::Calc qw( Today Days_in_Month Date_to_Text); 

  ($year,$month) = Today();

#calculating previous month

  if ($month == 1)
  {
        $previous_mon = "12";
        $year = $year - 1;
        $days=Days_in_Month($year,$previous_mon);
        $begin_date = "01";
        $end_date = $days;
  print "Previous Month's Dates were From $year $previous_mon$begin_date To $year 
$previous_mon$end_date.\n" 
  }
  else
  {
      if ($month > 1)
      {
          $previous_mon = $month - 1;
          $days=Days_in_Month($year,$previous_mon);
          $begin_date = "01";
          $end_date = $days;
  print "Previous Month's Dates were From $year $previous_mon$begin_date To $year 
$previous_mon$end_date.\n" 
      }
   }  

2)Previous Week
#!/usr/bin/perl

use Date::Calc qw( Today Day_of_Week Add_Delta_Days
                     Day_of_Week_to_Text Date_to_Text );

  $saturday_dow = 6; # 6 = Saturday
  $sunday_dow = 7; # 7 = Sunday
  @today = Today();
  $current_dow = Day_of_Week(@today);

#calculating saturday's date of previous week

  if ($saturday_dow == $current_dow)
  {
      @prev = Add_Delta_Days(@today,-7);
  }
  else
  {
      if ($saturday_dow > $current_dow)
      {
          @next = Add_Delta_Days(@today,
                    $saturday_dow - $current_dow);
          @prev = Add_Delta_Days(@next,-7);
      }

      else 
      {
          @prev = Add_Delta_Days(@today,
                    $saturday_dow - $current_dow);
          @next = Add_Delta_Days(@prev,+7);
      }
   }  
  $dow = Day_of_Week_to_Text($saturday_dow);
  print "Today is:      ", ' ' x length($dow),
                               Date_to_Text(@today), "\n";

@previoussaturday=@prev;


#calculating sunday's date of previous week
#sunday is 7, which is larger than any other weekday 1-7

  if ($sunday_dow == $current_dow)
  {
      @prev = Add_Delta_Days(@today,-14);
  }
  else
  {
      if ($sunday_dow > $current_dow)
      {
          @next = Add_Delta_Days(@today,
                    $sunday_dow - $current_dow);
          @prev = Add_Delta_Days(@next,-14);
      }
  }
  $dow2 = Day_of_Week_to_Text($sunday_dow);
  @previoussunday=@prev; 

  print "Previous Weeks Dates were From @previoussunday To @previoussaturday.\n"


__
Get your own FREE, personal Netscape Webmail account today at 
http://webmail.netscape.com/