Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 12 lines (11 sloc) 367 Bytes
#!/usr/bin/perl
use strict;
sub usage { print STDERR "usage: splice LINES [file ...]\n" and exit -1 }
my $lines = shift || usage();
my(@first,@last,$i) = ();
for my $block (split ',', $lines) {
my @l = split '-', $block;
push @first, $l[0];
push @last, $l[1] || $first[-1];
}
($.==$first[$i]||($.==$first[$i+1]&&++$i)) .. $.==$last[$i] and print while <>