当前位置: 技术问答>linux和unix
求助(如何删除多余的字段)
来源: 互联网 发布时间:2017-02-10
本文导语: 假设现在文件中有下列字段: blogweek.blog.163.com book.163.com caichongda.blog.163.com caipiao.163.com date.cd.house.163.com 如何只保留后面3个(*.163.com),多出的部分删除掉: 期望效果: blog.163.com book.163.com blog.163.com caipiao.163.com house....
假设现在文件中有下列字段:
blogweek.blog.163.com
book.163.com
caichongda.blog.163.com
caipiao.163.com
date.cd.house.163.com
如何只保留后面3个(*.163.com),多出的部分删除掉:
期望效果:
blog.163.com
book.163.com
blog.163.com
caipiao.163.com
house.163.com
blogweek.blog.163.com
book.163.com
caichongda.blog.163.com
caipiao.163.com
date.cd.house.163.com
如何只保留后面3个(*.163.com),多出的部分删除掉:
期望效果:
blog.163.com
book.163.com
blog.163.com
caipiao.163.com
house.163.com
|
[root@jx-csblog01.jx.baidu.com liangdong]# echo "date.cd.house.163.com" | awk -F '.' '{print $(NF-2)"."$(NF-1)"."$NF}'
house.163.com
house.163.com