I need to extract (or count) the lines (in a file) that have two or more dots. The lines should not start with dot (it’s OK if they end with a dot), and there must not be two dots in a row (i.e., the dots are all separated with non-dot characters).
a.b. a.b.com a.b.c. a.b.c.com
a.com a..b a.b.c..d
I did this command:
grep -P '^[^.]+\.([^.]+\.)+[.]+' file.txt | wc -l
but it didn't find any matching lines. How should I do this?