in reply to Re^2: regular expression for log file date ~ questions and ideas ~
in thread regular expression for log file date ~ questions and ideas ~

Only you know what randomnum is, we can only assume it will be random and unpredictable. :)
my $randomNum = getMyRandomNum(); my $directory = "/path/to/some/dir"; openddir DIR, $directory or die "opening $directory failed"; my $specialRegex = qr/$randomNum.*log$/i; my @logfiles = grep /$specialRegex/, readdir DIR; for my $logfile (@logfiles) { open LOG "<", $logfile or warn "...."; while (<LOG>) { print if dateMatches() .. 0; # should print all lines from where d +ateMatches() returns TRUE. ... } }


perl -e '$,=$",$_=(split/\W/,$^X)[y[eval]]]+--$_],print+just,another,split,hack'er

Replies are listed 'Best First'.
Re^4: regular expression for log file date ~ questions and ideas ~
by perl_geoff (Acolyte) on Dec 04, 2006 at 14:35 UTC
    hmmm...where is your subroutine getMyRandomNum? Aside from that, some of your ideas look pretty helpful.
      getMyRandomNum() was for you to write :)


      perl -e '$,=$",$_=(split/\W/,$^X)[y[eval]]]+--$_],print+just,another,split,hack'er