Mercurial > hg > Game > Cerium
changeset 1933:d7f1710e0070 draft
add bigfile.pl
author | Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 01 Feb 2014 20:44:06 +0900 |
parents | f57779f1d93a |
children | 3d54a6c26caa |
files | example/regex_mas/bigfile.pl |
diffstat | 1 files changed, 29 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/regex_mas/bigfile.pl Sat Feb 01 20:44:06 2014 +0900 @@ -0,0 +1,29 @@ +#!/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) : $make_filesize\n"; + +while ($loop_counter < $loop_num) { + $exec_result = `cat $original_filename >> $make_filename`; + $loop_counter++; +} +