= 2) $csv_file = $argv[1]; if (count($argv) >= 3) $output = $argv[2]; if (!is_file($csv_file)) die("CSV file '$csv_file' not found.\n"); if ($output) { if(is_file($output)) die("Output file '$output' already exists.\n"); } else echo "No output file specified: export on STDOUT\n"; $rows = load_csv_file($csv_file); echo "Handle CVS file rows... "; $corps = array(); foreach($rows as $row) { if (!$row['CORPS'] || !$row['LIBELLE_LONG']) continue; $corps[strval($row['CORPS'])] = trim($row['LIBELLE_LONG']); } echo "done.\n".count($corps)." corp(s) found.\n"; if ($output) { $ofd = fopen($output, 'w') or die("Fail to open output file '$output'.\n"); } else { $ofd = STDOUT; } $stats = stat($csv_file); fwrite($ofd, "