i am creating the file , when this file reaches the size 2 GB, i need one message or fire
Please re-phrase in English: You need "one message or fire"?
One way to accomplish this is to pipe your output to a program which counts the bytes it has seen, and otherwise passes them through to their final destination. When the count is 2GB, it closes the file and opens a new one, resets the counter, and continues.
You mentioned Passes them through to their final destionation, when the count is 2GB. It closes the file and opens a new one
Can you explain the this point with an example?
#!/usr/bin/perl
$output=shift @ARGV;
$output.=".0000";
open(OUTPUT,">" . $output);
while (<STDIN>) {
if ($count + length($_))>(2*1024*1024*1024)) {
close(OUTPUT);
++$output;
open(OUTPUT,">" . $output);
$count=0;
}
$count += length($_);
print OUTPUT $_;
}
Does the basics with no error checking
Thanks