Export and Import of blacklist, blacklist wildcard, whitelist and whitelist wildcard as 4 txt files

At the moment I have to copy from the pihole web page and paste into a new file.
Then remove the double CR and the Tabs from the end of each line.
I then have to cut and paste the Wildcard domains to a seperate list.

This would speed up sharing, testing and trouble shooting of a blocklist quite a bit so I could add to a blocklist then update gravity then remove all manual entries from the pihole.

My current blacklist has over 150 items on it from about 2 weeks work.

Failing that I would need write a program to parse the teleported files from the json files in QB64.

You don't have to do either of these things.

SQL commands will export domains to the screen, or you can redirect to a text file.

Example - export enabled exact blacklist entries:

sudo sqlite3 /etc/pihole/gravity.db "SELECT domain FROM domainlist WHERE enabled = 1 AND type = 1;"

Example - export all exact whitelist entries:

sudo sqlite3 /etc/pihole/gravity.db "SELECT domain FROM domainlist WHERE type = 0;"

Modify the command as needed for whichever category of domain entry you want to see:

https://docs.pi-hole.net/database/gravity/#domain-tables-domainlist

ok I tried it but this is what I got.
2 are fresh Raspbian installs a few months ago.
It works on one an older pihole install.

From passwd -S
Install date Raspberry pi 02/14/2021 Works
Install date 08/08/2022 not working. 2022-04-04-raspios-buster-armhf.img
Install date 05/25/2022 not working 2022-04-04-raspios-buster-armhf.img

root@pihole7:~# sudo sqlite3 /etc/pihole/gravity.db "SELECT domain FROM domainlist WHERE enabled = 1 AND type = 1;"
sudo: sqlite3: command not found
root@pihole7:~#

Replace sqlite3 in the command above with pihole-FTL sqlite3