Mercurial > repos > devteam > remove_beginning
diff remove_beginning.pl @ 0:19d2ccf95640 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/remove_beginning commit 5a4e0ca9992af3a6e5ed2b533f04bb82ce761e0b
author | devteam |
---|---|
date | Mon, 09 Nov 2015 11:51:52 -0500 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/remove_beginning.pl Mon Nov 09 11:51:52 2015 -0500 @@ -0,0 +1,33 @@ +#! /usr/bin/perl -w + +use strict; +use warnings; + +# Removes the specified number of lines from the beginning of the file. +# remove_beginning.pl [input] [num_lines] [output] + +die "Check arguments" unless @ARGV == 3; + +my $inputfile = $ARGV[0]; +my $num_lines = $ARGV[1]; +my $outputfile = $ARGV[2]; + +my $curCount=0; + +my $fhIn; +open ($fhIn, "< $inputfile") or die "Cannot open source file"; + +my $fhOut; +open ($fhOut, "> $outputfile"); + +while (<$fhIn>) +{ + $curCount++; + if ($curCount<=$num_lines) + { + next; + } + print $fhOut $_; +} +close ($fhIn) or die "Cannot close source file"; +close ($fhOut) or die "Cannot close output file";