Craig Sharp wrote:
> Hi all,
>
> I know this is simple but I have having a brain lock today.
>
> I have a file in which I need to find a particular line. Once I find the
> line, I need to print the next 5 lines and quit.
>
> The following gets me to the line but I am stuck from there.
>
> #!
Hi Craig,
You need to use a counter.
my $count =0;
$count++;
You will need to also check the counter on each loop
iteration using 'if' 'else' and 'last' to exit the
loop..
my $count=0;
if ($count > 4)
{
last
}
else
{
$count++;
}
there's several ways to do this
Here is one.. Incidentally, un
Tim,
Perfect! Thanks for the help.
Craig
>>> <[EMAIL PROTECTED]> 01/31/05 11:15AM >>>
Try this...
#!/usr/bin/perl -w
open (INFILE, "< filemon2005012970.out") || die("Cannot open file: $!");
while () {
chomp;
if (/\/dev\/hdisk18 description:/){
for (my $x = 0; $x < 5; $x++
Hi all,
I know this is simple but I have having a brain lock today.
I have a file in which I need to find a particular line. Once I find the line,
I need to print the next 5 lines and quit.
The following gets me to the line but I am stuck from there.
#!/usr/bin/perl -w
open (INFILE,"filemon2