I quickly checked online and few options are:
1. Use websites that allow you to enter addresses in bulk and then they will check the balance. I'm assuming they do it all client-side in the browser and use an API key to query one of the blockchain explorers.
You can do this in two ways:
1)
- Offline machine: Writing a simple script that searches for the public key (Bitcoin addresses) and extracts it to a file.
- Online version: check the addresses that contain a balance and then return again to offline machine to extract the private keys for addresses with balance only.
2) dump wallet using pywallet.py
https://github.com/jackjack-jj/pywallet using the command
python pywallet.py --dumpwallet // (dump wallet in json format)
dealing with json format is easier than txt file.