annotate tailWrapper.pl @ 2:3354a96a6cd8 draft

planemo upload commit 00a7926c285bc4a339bd7deebf40b28f39c7d947-dirty
author devteam
date Tue, 21 Jul 2015 15:59:08 -0400
parents 8bb4d908a523
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8bb4d908a523 Uploaded show_tail tarball.
devteam
parents:
diff changeset
1 #! /usr/bin/perl -w
8bb4d908a523 Uploaded show_tail tarball.
devteam
parents:
diff changeset
2
8bb4d908a523 Uploaded show_tail tarball.
devteam
parents:
diff changeset
3 use strict;
8bb4d908a523 Uploaded show_tail tarball.
devteam
parents:
diff changeset
4 use warnings;
8bb4d908a523 Uploaded show_tail tarball.
devteam
parents:
diff changeset
5
8bb4d908a523 Uploaded show_tail tarball.
devteam
parents:
diff changeset
6 # a wrapper for tail for use in galaxy
8bb4d908a523 Uploaded show_tail tarball.
devteam
parents:
diff changeset
7 # lessWrapper.pl [filename] [# lines to show] [output]
8bb4d908a523 Uploaded show_tail tarball.
devteam
parents:
diff changeset
8
8bb4d908a523 Uploaded show_tail tarball.
devteam
parents:
diff changeset
9 die "Check arguments" unless @ARGV == 3;
8bb4d908a523 Uploaded show_tail tarball.
devteam
parents:
diff changeset
10 die "Line number should be an integer\n" unless $ARGV[1]=~ m/^\d+$/;
8bb4d908a523 Uploaded show_tail tarball.
devteam
parents:
diff changeset
11
8bb4d908a523 Uploaded show_tail tarball.
devteam
parents:
diff changeset
12 open (OUT, ">$ARGV[2]") or die "Cannot create $ARGV[2]:$!\n";
8bb4d908a523 Uploaded show_tail tarball.
devteam
parents:
diff changeset
13 open (TAIL, "tail -n $ARGV[1] $ARGV[0]|") or die "Cannot run tail:$!\n";
8bb4d908a523 Uploaded show_tail tarball.
devteam
parents:
diff changeset
14 while (<TAIL>) {
8bb4d908a523 Uploaded show_tail tarball.
devteam
parents:
diff changeset
15 print OUT;
8bb4d908a523 Uploaded show_tail tarball.
devteam
parents:
diff changeset
16 }
8bb4d908a523 Uploaded show_tail tarball.
devteam
parents:
diff changeset
17 close OUT;
8bb4d908a523 Uploaded show_tail tarball.
devteam
parents:
diff changeset
18 close TAIL;
8bb4d908a523 Uploaded show_tail tarball.
devteam
parents:
diff changeset
19