Skip to content

Instantly share code, notes, and snippets.

@fand
Created January 23, 2016 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fand/8faa15c0dd0c52d48b2e to your computer and use it in GitHub Desktop.
Save fand/8faa15c0dd0c52d48b2e to your computer and use it in GitHub Desktop.
指定した行抜き出す君
#!/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