Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/perl -n -s -i
|
||||
print unless $. >= $from && $. <= $to;
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/perl -w
|
||||
use strict ;
|
||||
use Tie::File ;
|
||||
|
||||
sub deletelines {
|
||||
my $arguments = shift ;
|
||||
my( $file , $startfrom , $howmany ) = @{$arguments} ;
|
||||
tie my @lines , 'Tie::File' , $file or die "Can't find file $file!\n" ;
|
||||
my $nrecs = @lines ;
|
||||
if ( $startfrom > $nrecs ) {
|
||||
print "Error! Starting to delete lines past the end of the file!\n" ;
|
||||
return ;
|
||||
}
|
||||
if ( ( $startfrom + $howmany ) > $nrecs ) {
|
||||
print "Error! Trying to delete lines past the end of the file!\n" ;
|
||||
return ;
|
||||
}
|
||||
splice @lines , $startfrom - 1 , $howmany ;
|
||||
untie @lines ;
|
||||
}
|
||||
|
||||
if ( @ARGV != 3 ) {
|
||||
print "Error! Invoke with deletelines <filename> <start> <skiplines> !\n" ;
|
||||
exit( 1 ) ;
|
||||
}
|
||||
|
||||
deletelines( \@ARGV ) ;
|
||||
Loading…
Add table
Add a link
Reference in a new issue