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