$
$ cat -n logfile
1 this is the first line
2 this is the second line
3 Script /opt/OV/bin/OpC/agtinstall/inst.sh invoked by root at 02/25/11 15:12:50
4 this is the fourth line
5 Script /opt/OV/bin/OpC/agtinstall/inst.sh invoked by root at 02/26/11
6 21:45:39
7 this is the seventh line
$
$
$ perl -lne 'BEGIN {undef $/} print $1 while (/\n(Script.*?invoked by root at (\d+)\/(\d+)\/(\d+).*?(\d+):(\d+):(\d+))/msg)' logfile
Script /opt/OV/bin/OpC/agtinstall/inst.sh invoked by root at 02/25/11 15:12:50
Script /opt/OV/bin/OpC/agtinstall/inst.sh invoked by root at 02/26/11
21:45:39
$
$
The code doesnt seem to work. Actually i have another similar pattern at the bottom of the fiole which is this format
HPOM maintenance summary: 02/26/11 15:39:58. So this search pattern which u specified is matching this one instead of the first one which i specified .
---------- Post updated at 08:37 PM ---------- Previous update was at 02:36 AM ----------
I have made the breakthroufg. here is the code snippet
open(INFILE,"install.log")|| die("File not found");
while($line = <INFILE>)
{
if ($line =~ /((\d+)\/(\d+)\/(\d+))\Z/g)
{
$match = $&;
$nextline = <INFILE>;
$start="$match$nextline";
if($start =~ /(\d+)\/(\d+)\/(\d+)\s+(\d+):(\d+)(\d+)/)
{
print $4,"\n";
}
} # end if if
elsif ($line =~ /invoked by root at ((\d+)\/(\d+)\/(\d+))\s+(\d+):(\d+):(\d+)\Z/)
{
print $&;
}
} # //end if while