I'd like to split some files, because they are too large for me to analyse them(100Megs and above)
See how i do it:
$file = "file";
$fp = @fopen ("W3SVC36new.log","r");
$long=10000000; //size of the little files
// created
$i=1; //this is to create each time
a new file name
while (!(feof($fp)))
{
$fp2 = @fopen ($file.$i,"w");
$tableau = @fread($fp,$long);
$table = explode("\n",$tableau);
foreach ($table as $elem)
{
fwrite ($fp2,$elem);
fwrite ($fp2,"\n");
}
$i=$i+1;
}
?>
In fact, i specify a size in the fread, i format the string i get, and i store it in a new file.
I do this until the end of the Large File.
The problem is that, using fread, i often cut a line in the middle, so a part is in a file, and the end is in the next file created.
I hope someone will understand and help me.
Thank You.