annotate headWrapper.pl @ 3:b5af46a99f6e draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_beginning commit a1517c9d22029095120643bbe2c8fa53754dd2b7
author devteam
date Wed, 11 Nov 2015 12:27:35 -0500
parents ecca14446e6a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ecca14446e6a Uploaded show_beginning tarball.
devteam
parents:
diff changeset
1 #! /usr/bin/perl -w
ecca14446e6a Uploaded show_beginning tarball.
devteam
parents:
diff changeset
2
ecca14446e6a Uploaded show_beginning tarball.
devteam
parents:
diff changeset
3 use strict;
ecca14446e6a Uploaded show_beginning tarball.
devteam
parents:
diff changeset
4 use warnings;
ecca14446e6a Uploaded show_beginning tarball.
devteam
parents:
diff changeset
5
ecca14446e6a Uploaded show_beginning tarball.
devteam
parents:
diff changeset
6 # a wrapper for head for use in galaxy
ecca14446e6a Uploaded show_beginning tarball.
devteam
parents:
diff changeset
7 # headWrapper.pl [filename] [# lines to show] [output]
ecca14446e6a Uploaded show_beginning tarball.
devteam
parents:
diff changeset
8
ecca14446e6a Uploaded show_beginning tarball.
devteam
parents:
diff changeset
9 die "Check arguments" unless @ARGV == 3;
ecca14446e6a Uploaded show_beginning tarball.
devteam
parents:
diff changeset
10 die "Line number must be an integer\n" unless $ARGV[1]=~ m/^\d+$/;
ecca14446e6a Uploaded show_beginning tarball.
devteam
parents:
diff changeset
11
ecca14446e6a Uploaded show_beginning tarball.
devteam
parents:
diff changeset
12 open (OUT, ">$ARGV[2]") or die "Cannot create $ARGV[2]:$!\n";
ecca14446e6a Uploaded show_beginning tarball.
devteam
parents:
diff changeset
13 open (HEAD, "head -n $ARGV[1] $ARGV[0]|") or die "Cannot run head:$!\n";
ecca14446e6a Uploaded show_beginning tarball.
devteam
parents:
diff changeset
14 while (<HEAD>) {
ecca14446e6a Uploaded show_beginning tarball.
devteam
parents:
diff changeset
15 print OUT;
ecca14446e6a Uploaded show_beginning tarball.
devteam
parents:
diff changeset
16 }
ecca14446e6a Uploaded show_beginning tarball.
devteam
parents:
diff changeset
17 close OUT;
ecca14446e6a Uploaded show_beginning tarball.
devteam
parents:
diff changeset
18 close HEAD;
ecca14446e6a Uploaded show_beginning tarball.
devteam
parents:
diff changeset
19