#!/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 incremental 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).".dat") 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;