view @ 3:b5af46a99f6e draft default tip

planemo upload for repository commit a1517c9d22029095120643bbe2c8fa53754dd2b7
author devteam
date Wed, 11 Nov 2015 12:27:35 -0500
parents ecca14446e6a
line wrap: on
line source

#! /usr/bin/perl -w

use strict;
use warnings;

# a wrapper for head for use in galaxy
# [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;