= 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... "; $roles_generiques = array(); foreach($rows as $row) { if (!$row['FONCTION_ADMINISTRATIVE'] || !$row['supannRoleGenerique']) continue; $roles_generiques[$row['FONCTION_ADMINISTRATIVE']] = trim($row['supannRoleGenerique']); } echo "done.\n".count($roles_generiques)." role(s) generique(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, "