root/galaxy-central/tools/filters/remove_beginning.pl @ 2

リビジョン 2, 0.6 KB (コミッタ: hatakeyama, 14 年 前)

import galaxy-central

行番号 
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";
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。