Skip to content

Commit

Permalink
A command to take lines from file.
Browse files Browse the repository at this point in the history
  • Loading branch information
gugod committed Nov 26, 2015
1 parent 6d2d6cd commit 64e1679
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions takeline
@@ -0,0 +1,22 @@
#!/usr/bin/env perl
use strict;
use warnings;
use Getopt::Long;

my %args;
GetOptions(
\%args,
"line=i",
"context=i"
);

die unless defined $args{line};
$args{context} ||= 0;

my ($from, $until) = ( $args{line} - $args{context}, $args{line} + $args{context} );

while(<>) {
if ($. == $from .. $. == $until) {
print;
}
}

0 comments on commit 64e1679

Please sign in to comment.