73 Lines of Mayhem - Parse, Sort and Save to CSV in PHP CLI
This will be much more efficient:

$result = array();

if (($handle = opendir('./txt/')) !== false)
{
    set_time_limit(0);
    ini_set('memory_limit', -1);

    while (($file = readdir($handle)) !== false)
    {
        if (($file != '.') &amp;&amp; ($file != '..'))
        {
            if (is_resource($file = fopen('./txt/' . $file, 'rb')) === true)
            {
                while (($email = fgets($file)) !== false)
                {
                    $email = trim(str_replace(array(',', '"'), '', $email));

                    if (filter_var($email, FILTER_VALIDATE_EMAIL) !== false)
                    {
                        $result[strtolower($email)] = true;
                    }
                }

                fclose($file);
            }
        }
    }

    closedir($handle);

    if (empty($result) !== true)
    {
        ksort($result);

        foreach (array_chunk($result, 10000, true) as $key =&gt; $value)
        {
            file_put_contents('./emailList-' . ($key + 1) . '.csv', implode("\n", array_keys($value)), LOCK_EX);
        }
    }

    echo 'Done!';
}