awk 用法:
awk -F 参数用法:指定分隔符
我的源文档:
more domain.log
http://www.baidu.com/index.html
http://www.google.com/1.html
http://www.baidu.com/1.html
[[email protected] ~]# awk -F "/" ‘{print $3}‘ domain.log
www.baidu.com
www.google.com
www.baidu.com[[email protected] ~]# awk -F "/" ‘{print $1}‘ domain.log
http:
http:
http:[[email protected] ~]# awk -F "/" ‘{print $2}‘ domain.log
[[email protected] ~]# awk -F "/" ‘{print $4}‘ domain.log
index.html
1.html
1.html
[[email protected] ~]# awk -F "//" ‘{print $4}‘ domain.log
[[email protected] ~]# awk -F "//" ‘{print $2}‘ domain.log
www.baidu.com/index.html
www.google.com/1.html
www.baidu.com/1.html
[[email protected] ~]# awk -F "//" ‘{print $2}‘ domain.log |sort |uniq -c|sort -rn
2 www.baidu.com/index.html
1 www.google.com/1.html
1 www.baidu.com/1.html