Skip to content

Instantly share code, notes, and snippets.

@fand

fand/line.pl

Created Jan 23, 2016
Embed
What would you like to do?
指定した行抜き出す君
#!/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
You can’t perform that action at this time.