Mercurial > repos > devteam > show_beginning
comparison headWrapper.pl @ 0:ecca14446e6a
Uploaded show_beginning tarball.
author | devteam |
---|---|
date | Tue, 04 Dec 2012 11:05:17 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:ecca14446e6a |
---|---|
1 #! /usr/bin/perl -w | |
2 | |
3 use strict; | |
4 use warnings; | |
5 | |
6 # a wrapper for head for use in galaxy | |
7 # headWrapper.pl [filename] [# lines to show] [output] | |
8 | |
9 die "Check arguments" unless @ARGV == 3; | |
10 die "Line number must be an integer\n" unless $ARGV[1]=~ m/^\d+$/; | |
11 | |
12 open (OUT, ">$ARGV[2]") or die "Cannot create $ARGV[2]:$!\n"; | |
13 open (HEAD, "head -n $ARGV[1] $ARGV[0]|") or die "Cannot run head:$!\n"; | |
14 while (<HEAD>) { | |
15 print OUT; | |
16 } | |
17 close OUT; | |
18 close HEAD; | |
19 |