Here, just in case you need it, is such a program
$ cat ~/bin/allbutLike head and tail, allbut defaults to 10, so allbut foo prints all but the last 10 lines of foo.
#!/usr/bin/perl -ws
use strict;
die "usage: $0 [-h] [-n=N] [filename]\n" if our $h;
our $n ||= 10; # how many on the end to omit; default=10;
@_ = (undef) x $n;
while (<>) {
push @_, $_ ;
$_ = shift @_;
print $_ if defined $_;
}
$ for i in {1..20}; do echo $i; done | allbut -n=13
1
2
3
4
5
6
7
I was tempted to call it callipygian; however, that would be "all butt," and risk confusion with tail.
No comments:
Post a Comment