zoukankan      html  css  js  c++  java
  • awk指定[]为分隔符

    root@standby[16:38:35]$ 
    root@standby[16:38:35]$ cat tmp.log 
    qq [8.8.8.8] 6.6.6.6 [1502301436.016] "GET / HTTP/1.1" 200 21 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36" "-" "0.059"
    qq [9.9.9.9] 6.6.6.6 [1502387868.069] "GET / HTTP/1.1" 200 21 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36" "-" "0.059"
    qq [2.2.2.2] 6.6.6.6 [1502474196.260] "GET / HTTP/1.1" 200 21 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.120 Safari/537.36" "-" "0.059"
    root@standby[16:38:41]$ 
    root@standby[16:38:42]$ awk -F "[][]" '{print $2"	"$3"	"$4}' tmp.log 
    8.8.8.8	 6.6.6.6 	1502301436.016
    9.9.9.9	 6.6.6.6 	1502387868.069
    2.2.2.2	 6.6.6.6 	1502474196.260
    root@standby[16:38:43]$ 
    

      

    作者:Standby一生热爱名山大川、草原沙漠,还有妹子
    出处:http://www.cnblogs.com/standby/

    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    Murano Weekly Meeting 2015.11.04
    Python pdb调试
    Neutron命令测试5
    Neutron命令测试4
    Neutron命令测试3
    Neutron命令测试2
    Neutron命令测试1
    Murano Weekly Meeting 2015.10.20
    Murano Weekly Meeting 2015.10.13
    wireshark分析dhcp过程
  • 原文地址:https://www.cnblogs.com/standby/p/8329775.html
Copyright © 2011-2022 走看看