annotate tailWrapper.pl @ 3:ae45155543e1
draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_tail commit a1517c9d22029095120643bbe2c8fa53754dd2b7
author |
devteam |
date |
Wed, 11 Nov 2015 12:27:48 -0500 |
parents |
8bb4d908a523 |
children |
|
rev |
line source |
0
|
1 #! /usr/bin/perl -w
|
|
2
|
|
3 use strict;
|
|
4 use warnings;
|
|
5
|
|
6 # a wrapper for tail for use in galaxy
|
|
7 # lessWrapper.pl [filename] [# lines to show] [output]
|
|
8
|
|
9 die "Check arguments" unless @ARGV == 3;
|
|
10 die "Line number should be an integer\n" unless $ARGV[1]=~ m/^\d+$/;
|
|
11
|
|
12 open (OUT, ">$ARGV[2]") or die "Cannot create $ARGV[2]:$!\n";
|
|
13 open (TAIL, "tail -n $ARGV[1] $ARGV[0]|") or die "Cannot run tail:$!\n";
|
|
14 while (<TAIL>) {
|
|
15 print OUT;
|
|
16 }
|
|
17 close OUT;
|
|
18 close TAIL;
|
|
19
|