[EMAIL PROTECTED] wrote on 16 Nov 2001:
> What I want to do is scroll thru the file and when it finds the line
> that starts with "NC00" print that line and the next 5 lines.
Here's one way:
while () {
next unless /^NC00/;
print;
$_ = , print for 1..5;
}
--
David Wall
[EMAIL PROTE
howabout
while () {
next unless /^NC00/;
push @required , $_;
}
On Fri, Nov 16, 2001 at 03:42:59PM -0500, [EMAIL PROTECTED] shaped the
electrons to read:
> Hello All,
> This appears to be quite simple, but yet the answer has eluded me.
> I can/kow how to use a foreach loop to
One way (probably not the most elegant)
set a flag variable to 0
my $flagv=0
foreach to read file
{
$flag=1 if (/^NC00/);
if ($flag)
{
store line
increment counter
if counter >5 $flag=0
}
--
Chris D. Garringer
LAN/WAN Supervisor
Toshiba International
713-466-0277 x
Hello All,
This appears to be quite simple, but yet the answer has eluded me.
I can/kow how to use a foreach loop to pull one line from a file. But what
I am trying to do is this.
I have a file that has about 200 lines of junk and about 10 lines that I
really
need. Some thing that looks like t