Created
January 23, 2016 12:01
-
-
Save fand/8faa15c0dd0c52d48b2e to your computer and use it in GitHub Desktop.
指定した行抜き出す君
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
my $line = $ARGV[0]; | |
my $margin = $ARGV[1] // 0; | |
open my $dst, '|-', "head -n @{[$line + $margin]} | tail -n @{[$margin * 2 + 1]}"; | |
while (<STDIN>){ | |
print $dst $_; | |
} | |
close $dst; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment