/tools/filters/remove_beginning.pl
https://bitbucket.org/h_morita_dbcls/galaxy-central · Perl · 33 lines · 22 code · 8 blank · 3 comment · 3 complexity · 690f6f4c143a2bbdf97f5f3a69285f63 MD5 · raw file
- #! /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";