Marcelo wrote:
> Hi everybody...
> How I can take lines from a file like this ...
>
> line1=A
> line2
> line3
>
> line1=B
> line2
> line3
>
> line1=A
> line2
> line3
>
> I want to take the followin 2 lines to the line1 when line1=A and
> write them to another file....
I'm not clear exactly what your file looks like, but the following will
output the two lines immediately following a line exactly matching
'line1=A'.
@ARGV = 'file.txt';
my $print;
while (<>) {
if ($print and $print--) { print }
else { $print = 2 if /^line1=A$/ }
}
HTH,
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]