How to remove the main domain from a list of subdomains for example if i have a file contains
www.example.com
sub.examle.com
sub2.example.com
examle.com.ar
example.com
I want to extract only
sub.example.com
sub2.example.com
I try
grep -v '^www.example.com' file.txt
how can i get sub domains