PageRenderTime 26ms CodeModel.GetById 16ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 1#! /usr/bin/perl -w
 2
 3use strict;
 4use warnings;
 5
 6# Removes the specified number of lines from the beginning of the file.
 7# remove_beginning.pl [input] [num_lines] [output]
 8
 9die "Check arguments" unless @ARGV == 3;
10
11my $inputfile = $ARGV[0];
12my $num_lines = $ARGV[1];
13my $outputfile = $ARGV[2];
14
15my $curCount=0;
16
17my $fhIn;
18open ($fhIn, "< $inputfile") or die "Cannot open source file";
19
20my $fhOut;
21open ($fhOut, "> $outputfile");
22
23while (<$fhIn>)
24{
25    $curCount++;
26    if ($curCount<=$num_lines)
27    {
28        next;
29    }
30    print $fhOut $_;
31}
32close ($fhIn) or die "Cannot close source file";
33close ($fhOut) or die "Cannot close output file";