Mercurial > repos > devteam > show_beginning
diff headWrapper.pl @ 0:a15394f3d04f draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/show_beginning commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
author | devteam |
---|---|
date | Mon, 09 Nov 2015 11:56:04 -0500 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/headWrapper.pl Mon Nov 09 11:56:04 2015 -0500 @@ -0,0 +1,19 @@ +#! /usr/bin/perl -w + +use strict; +use warnings; + +# a wrapper for head for use in galaxy +# headWrapper.pl [filename] [# lines to show] [output] + +die "Check arguments" unless @ARGV == 3; +die "Line number must be an integer\n" unless $ARGV[1]=~ m/^\d+$/; + +open (OUT, ">$ARGV[2]") or die "Cannot create $ARGV[2]:$!\n"; +open (HEAD, "head -n $ARGV[1] $ARGV[0]|") or die "Cannot run head:$!\n"; +while (<HEAD>) { + print OUT; +} +close OUT; +close HEAD; +