view example/regex_mas/bigfile.pl @ 1954:30b95f372a0d draft

fix read_size
author masa
date Thu, 06 Feb 2014 20:08:08 +0900
parents 3d54a6c26caa
children
line wrap: on
line source

#!/usr/bin/perl

my $loop_counter = 0;
my $exec_result = 0;

my $original_filename = $ARGV[0];
my $make_filename = $ARGV[1];
my $make_filesize = $ARGV[2] * 1024 * 1024 * 1024;

if (@ARGV != 3) {
    print("Usage: ./bigfile.pl [original filename] [make filename] [make filesilze(GB)]\n");
    exit(0);
}

my $original_filesize = -s $original_filename;
my $loop_num = $make_filesize / $original_filesize;


print "original file name : $original_filename\n";
print "original file size : $original_filesize\n";
print "make     file name : $make_filename\n";
print "make     file size : $make_filesize\n";
print "make file size(GB) : $ARGV[2] GB\n";

while ($loop_counter < $loop_num) {
    $exec_result = `cat $original_filename >> $make_filename`;
    $loop_counter++;
}