in reply to Unexpected File Results
I get#!/usr/bin/perl -w use strict; my $self = {}; $self->{data} = './biglog.log'; $self->{process} = 1; my $increment = 1000000; #For this example $$config{blocksize} == 550 # my $blocksize = 550; my $startblock = 1; my $records = int($increment / $blocksize); my $bytecnt = $blocksize * $records; #After caluclations this prints out as 999900 print "bytecnt[$bytecnt]\n"; my $file = 0; open PARENT, $$self{data} or die "Cannot open [$$self{data}] for i +ncremental parsing\n"; while(1){ $file++; my $data = ""; if($file == 1){ read(PARENT, $data, $startblock); read(PARENT, $data, $bytecnt); open(FILE, ">tmp\\$$self{process}".sprintf("%02d", $file). +".dat") or die "Cannot open tmp\\$$self{process}".sprintf( +"%02d", $file).".dat for incremental writing\n"; print FILE $data; close(FILE); next; } read(PARENT, $data, $bytecnt); open(FILE, ">tmp\\$$self{process}".sprintf("%02d", $file).".da +t") or die "Cannot open tmp\\$$self{process}".sprintf("%02d", +$file).".dat for incremental writing\n"; print FILE $data; close(FILE); if(eof(PARENT)){ last; } } close(PARENT); die;
-rw-r--r-- 1 loot poot 6056869 May 30 10:48 biglog.log -rw-r--r-- 1 loot poot 1425 May 30 10:51 incspl.pl -rw-r--r-- 1 loot poot 999900 May 30 10:52 tmp\101.dat -rw-r--r-- 1 loot poot 999900 May 30 10:52 tmp\102.dat -rw-r--r-- 1 loot poot 999900 May 30 10:52 tmp\103.dat -rw-r--r-- 1 loot poot 999900 May 30 10:52 tmp\104.dat -rw-r--r-- 1 loot poot 999900 May 30 10:52 tmp\105.dat -rw-r--r-- 1 loot poot 999900 May 30 10:52 tmp\106.dat -rw-r--r-- 1 loot poot 57468 May 30 10:52 tmp\107.datYour problem must be the config??.. (Oh no.. could it be because you're using
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Unexpected File Results
by Grundle (Scribe) on May 30, 2007 at 15:15 UTC |