Put all private keys in privkeys.txt, one private key per line.
On Linux:
touch btcimport.sh
chmod +x btcimport.sh
echo "#/bin/bash" >btcimport.sh
echo "" >>btcimport.sh
for i in `cat privkeys.txt`; do echo "bitcoin-cli importprivkey $i \"\" false" >>btcimport.sh; done
vi btcimport.sh and turn the last "false" to "true" in order to reindex after the last import
Then ./btcimport.sh
On Windows:
for /f %i in (privkeys.txt) do @(echo bitcoin-cli.exe importprivkey %i "" false >>btcimport.bat)
notepad btcimport.bat and turn the last "false" to "true" in order to reindex after the last import
on prompt, run btcimport.bat
I tested the generation script only - haven't tried to run the importprivkey bash/batch script itsself, it's possible that you have to adapt the script for your system.