I'm trying to strip off the main domains from a list, ie:
ads.zedo.com
c1.zedo.com
c2.zedo.com
c3.zedo.com
foo.bar.zedo.com
c4.zedo.com
c5.zedo.com
zedo.com
blast.thing.duh.c6.zedo.com
c7.zedo.com
c8.zedo.com
d3.biz.frack.zedo.com
d3.zedo.com
d7.zedo.com
I was trying to pipe the above through awk or cut, such that I get 14
zedo.com returned:
If I could parse from right to left, with "." delimiter, I'd have my
list. But I'm curious if that is possible.
Help would be great.
Thanks!
IIUC, just do
awk -F'.' -v OFS='.' '{print $(NF-1),$NF}' file
That's it! Exactly what I needed. Thanks!