#!/usr/bin/perl
use strict;
use warnings;
open (IN,"testdata.dat") or die;
open (OUT,">>./someRN.txt") or die;
my $i=1;
while (<IN>) {
chomp;
if ($i>=2&&$i<=4) { #..1000.2000........LZ...........
print OUT "$_\n";
}
$i++;
}
seek(IN,0,0);
$i=1;
while (<IN>) {
chomp;
if ($i>=6&&$i<=8) { #..1000.2000........LZ...........
print OUT "$_\n";
}
$i++;
}
close IN;
close OUT;
perl读文件第m到n行的实例
最新推荐文章于 2024-07-15 22:13:36 发布