awk如何过滤如下格式日志中的字符串

扁豆焖面先生 发布于 2014/07/17 10:02
阅读 633
收藏 0
AWK
14/07/16 00:01:03 50135 5:5391 2.4.0.64 222.160.184.151:2128 218.25.208.101
14/07/16 00:01:06 162588 5:5391 2.4.0.64 36.40.138.206:1184 61.147.72.246
14/07/16 00:01:07 9009 11:2882 2.4.0.64 101.70.208.127:3703 61.147.72.246
14/07/16 00:01:07 31788 5:5392 2.4.0.64 171.42.182.38:1731 60.191.137.37
14/07/16 00:01:07 26660 10:1865 2.4.0.64 36.40.138.206:1185 60.191.137.37
14/07/16 00:01:09 15558 5:5390 2.4.0.64 218.92.101.170:4543 61.147.72.244
14/07/16 00:01:11 329919 5:5389 2.4.0.64 82.229.224.173:60479 182.92.0.191
14/07/16 00:01:15 30021275 10:1864 2.3.0.59 123.139.190.222:21768 61.147.72.245
14/07/16 00:01:16 989898 11:2880 2.4.0.64 221.2.42.130:56980 218.25.208.99
14/07/16 00:01:18 16648 11 :2879 2.4.0.64 124.119.58.71 :3065 182.92.0.191

14/07/16 00:01:21 11713 10:1862 2.4.0.64 61.53.173.122:4260 60.214.139.132

这样的日志我想把红色部分过滤掉如何实现,注意同时还要保持前面的时间格式!求大神。感谢~

加载中
1
char1st
char1st
awk '{print $1, $2,$3, substr($4,1,index($4,":")-1),$5 ,substr($6,1,index($6,":")-1), $7}' test.out




扁豆焖面先生
扁豆焖面先生
不错 ,但还可在改进
返回顶部
顶部