Trim down a list of sub-domains

If you need to trim down a list of sub-domains to only three levels of unique domains, and put the output into a new text file:

cat List_Of_Domains.txt | awk -F. '{print $(NF-2)"."$(NF-1)"."$(NF)}' | sort | uniq > New_Text_File.txt