Skip to content

Instantly share code, notes, and snippets.

@dmiedema
Created March 31, 2013 01:23
Show Gist options
  • Save dmiedema/5279092 to your computer and use it in GitHub Desktop.
Save dmiedema/5279092 to your computer and use it in GitHub Desktop.
PHP fixed size file parser. Designed to take a huge file and break it down into a bunch of smaller ones
<?php
$file = fopen($argv[1], "r");
$output = $argv[2];
$count= 0;
if ($file) {
while(!feof($file)) {
$buffer = fgets($file, 10240);
$newFile = fopen($output . $count, "w");
fwrite($newFile, $buffer);
$count++;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment