Mercurial > repos > devteam > show_tail
diff tailWrapper.pl @ 0:8bb4d908a523
Uploaded show_tail tarball.
author | devteam |
---|---|
date | Tue, 04 Dec 2012 11:06:47 -0500 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tailWrapper.pl Tue Dec 04 11:06:47 2012 -0500 @@ -0,0 +1,19 @@ +#! /usr/bin/perl -w + +use strict; +use warnings; + +# a wrapper for tail for use in galaxy +# lessWrapper.pl [filename] [# lines to show] [output] + +die "Check arguments" unless @ARGV == 3; +die "Line number should be an integer\n" unless $ARGV[1]=~ m/^\d+$/; + +open (OUT, ">$ARGV[2]") or die "Cannot create $ARGV[2]:$!\n"; +open (TAIL, "tail -n $ARGV[1] $ARGV[0]|") or die "Cannot run tail:$!\n"; +while (<TAIL>) { + print OUT; +} +close OUT; +close TAIL; +