#!/usr/bin/perl 

###########################################################
###########################################################
#
# Author(s):    Lee Chia Ling
# Date Created: 15 Oct 1999
# 
# Filter su logs
#
###########################################################
###########################################################

## $yesterday_month = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[(localtime(time-24*60*60))[4]];
## $yesterday_day   = (localtime(time-24*60*60))[3];
## print "yesterday_month  = ".$yesterday_month."\n";
## print "yesterday_day    = ".$yesterday_day."\n";

$yesterday = localtime(time-24*60*60);
## print "yesterday        = ".$yesterday."\n";
($yesterday_day_of_week, $yesterday_month, $yesterday_day) = split / +/, $yesterday;
## print "yesterday_month  = ".$yesterday_month."\n";
## print "yesterday_day    = ".$yesterday_day."\n";

while (<>) {

  # print "Original Line is = ".$_;
  ($month, $day, $time, $machine, $rest) = split / +/, $_, 5;
  # print "month   is       = ".$month."\n";
  # print "day     is       = ".$day."\n";
  # print "time    is       = ".$time."\n";
  # print "machine is       = ".$machine."\n";
  # print "rest    is       = ".$rest."\n";
  ($throwaway, $user) = split /for (.*) /, $rest;
  
  if (($month eq $yesterday_month) &&
      ($day   eq $yesterday_day) && 
      # ($user ne "") && 
        (($machine eq 'saturn') || 
         ($machine eq 'phoenix') ||
         ($machine eq 'alps'))) { 
    print $_;
    # print "Found user ".$user." at Line = ".$month." ".$day." ".$time." ".$machine." ".$rest." with throwaway = ".$throwaway."\n";
  }

} 
1