我有这样的网址列表:
http://example.com/sdfsdf/sdfsa
https://example2.com/53lasfd/asdfs
http://www.example3.com/asdfas/asdfasdf.php?=asdfa
https://subdomain.example4.com/index.php?id=sadfa
https://www.subdomain.example5.com/asdfas/asdfasd
我只需要提取没有http
,https
,www
以及所有/
之后的域(和子域):
exmaple.com
exmaple2.com
example3.com
subdomain.example4.com
subdomain.example5.com
答案 0 :(得分:2)
您可以使用awk -F/ '{sub(/^www\.?/,"",$3); print $3}' yourfile
,
$ awk -F/ '{sub(/^www\.?/,"",$3); print $3}' yourfile
example.com
example2.com
example3.com
subdomain.example4.com
subdomain.example5.com
<强>测试强>
Set shapeName = Selection