On Tue, 2004-08-24 at 14:49, rmck wrote: > Hello, Hi
> I have a script that I want to print only if between 08:00 and 17:00. Would I match
> every hour then print?? Any cleaner way to do this would be great. Thanks
>
> my($sec,$min,$hour,$mday,$mon);
> ($sec,$min,$hour,$mday,$mon)=localtime;
I would change this to
my ($sec,$min,$hour,$mday,$mon) = localtime;
> $timestamp=sprintf("%3s %02d %02d:%02d:%02d",$Month[$mon],$mday,$hour,$min,$sec);
>
> my $pidstring="pid(".$$."),";
>
> while(<STDIN>){
> $line = $_;
> if($line=~/OK/){
> open( OKLIST,">>/var/log/log.ok");
> print OKLIST $timestamp,":",$pidstring,$line;
> close(OKLIST);
> }else{
>
> if ( $hour =~ /^(08:|09:|10:|11:|12:|13:|14:|15:|16:|17:)/){
if ($hour > 7 and $hour < 18){
that would do the trick
> open( ERRLIST,">>/var/log/err.ok");
> print ERRLIST $timestamp,":",$pidstring,$line;
> close(ERRLIST);
> chomp($line);
> }
> }
> }
> exit;
>
>
>
> rob
--
Jos� Alves de Castro <[EMAIL PROTECTED]>
http://natura.di.uminho.pt/~jac
signature.asc
Description: This is a digitally signed message part
