This may use upwards of a meg of memory or so, but it sounds like a one-and-done thing (possibly on your local machine?) so no worries.

Highlight Mode: (PHP)
$lines = file( './domains.txt', FILE_IGNORE_NEW_LINES
| FILE_SKIP_EMPTY_LINES
); $lines = implode( PHP_EOL
, $lines );
...and by replacing
array_unique() with
array_flip()/
array_keys() you can cut the processing time in half-ish:
Highlight Mode: (PHP)
$lines = file( './domains.txt', FILE_IGNORE_NEW_LINES
| FILE_SKIP_EMPTY_LINES
); $lines = implode( PHP_EOL
, $lines );