如何从bash中的随机子域中检索主域

我正在寻找一种从随机域/子域检索主域(裸)的方法。我要查找的不是sed或awk命令(因为域是随机的),而是带有dig,host或nslookup的字符串,它们实际上可以显示裸域。有什么建议吗?

示例:

from www.bbc.co.uk -> bbc.co.uk
from www.google.com -> google.com
from subdomain.google.co.uk -> google.co.uk
from subdomain.ofasubdomain.google.com.au -> google.com.au 


mjc151767 回答:如何从bash中的随机子域中检索主域

我不是域名专家-基于https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains,除少数例外,所有后缀为2个字母的域的主域名均为something.bb.cc,所有其他后缀(通常为3个字母) ),则主域将是something.ccc

使用 Widget _gotoHomeScreen() { AuthService.getuserPrefEmail().then((email) { print(email); AuthService.email = email; if (email == null) { return LoginScreen(); } else { AuthService.uid = email; return HomeMenuScreen(); } });

bash

可以扩展为处理几个4个字母的域

本文链接:https://www.f2er.com/3153950.html

大家都在问