new-words
view part.pl @ 22:46e987f4636d
part.pl script + german normalization support
author | Igor Chubin <igor@chub.in> |
---|---|
date | Sun May 16 18:20:18 2010 +0300 (2010-05-16) |
parents | |
children |
line source
1 #!/usr/bin/perl
3 my @lines=<STDIN>;
4 my $lines=$#lines;
5 my $interval=$ARGV[0];
6 my ($start,$stop,$total);
7 if ($interval =~ m@(.*)/(.*)@) {
8 $start = $1;
9 $total = $2;
10 }
11 else {
12 $start=$interval;
13 $total=0;
14 }
15 if ($start =~ m@(.*)-(.*)@) {
16 $start = $1;
17 $stop = $2;
18 }
19 if ($start =~ m@(.*)\+(.*)@) {
20 $start = $1;
21 #if ($2 =~ /%$/) {
22 #}
23 #else {
24 $stop = $start+$2;
25 #}
26 }
27 #print "start = $start\n";
28 #print "stop = $stop\n";
29 #print "total = $total\n";
31 $start=int($lines/$total*$start);
32 $stop=int($lines/$total*$stop);
34 #print "start = $start\n";
35 #print "stop = $stop\n";
36 #print "total = $total\n";
37 for($i=$start;$i<$stop;$i++){
38 print $lines[$i];
39 }