Sqlite command to output gravity.db blocklist domains to text file?

Hi,

I previously used gravity.list as a text file for scripting, but now it's a database. Any idea how to dump all of the gravity.db blocklist DOMAINS to a file ?

I tried:
sudo sqlite3 /etc/pihole/gravity.db "select address from adlist" > outputfile.txt

But that only outputs the LIST URLS not actual domains.

Thanks

What you need is:

SELECT DISTINCT domain FROM gravity;

If you want to link those out to the adlists they came from:

SELECT gravity.domain, adlist.address FROM gravity JOIN adlist ON adlist.id = gravity.adlist_id;

Worked perfectly, time to read up on sqlite

Thanks

https://sqlzoo.net/