- 论坛徽章:
- 60
|
- [root[url=home.php?mod=space&uid=1880512]@HK[/url] tmp]# cat urfile
- Mar 20 09:00:20 LOG xxxx: GOT INFO: ip 192.168.1.91 to client with mac 00:01:00:27:b1:a7 ab = 12 valid 100 ms
- Mar 20 09:02:07 LOG xxxx: GOT INFO: ip 192.168.1.12 to client with mac 00:01:00:f5:41:ba ab = 14 bad
- Mar 20 09:13:20 LOG xxxx: GOT INFO: ip 192.168.1.19 to client with mac 00:01:00:e1:78:38 ab = 15 valid 120 ms
- Mar 20 09:24:39 LOG xxxx: GOT INFO: ip 192.168.1.91 to client with mac 00:01:00:27:b1:a7 ab = 12 valid 90 ms
- Mar 20 09:33:37 LOG xxxx: GOT INFO: ip 192.168.1.11 to client with mac 00:01:00:f5:41:ba ab = 143 bad
- Mar 20 09:35:38 LOG xxxx: GOT INFO: ip 192.168.1.12 to client with mac 00:01:00:f5:41:ba ab = 15 valid 220 ms
- Mar 20 09:36:37 LOG xxxx: GOT INFO: ip 192.168.1.11 to client with mac 00:01:00:f5:41:bb ab = 13 bad
- [root@hk tmp]#
- [root@hk tmp]# awk '{
- > cmd=sprintf("date -d \"%s %s %s\" \"+%%s\"",$1,$2,$3);
- > cmd|getline t;
- > close(cmd);
- > if(!a[$14]++)b[++n]=$14;
- > v=($18=="valid")?$18" "$19:$18;
- > c[$14]=t" "$9" "$14" "v
- > }
- >
- > END{
- > for(i=1;i<=n;i++)print c[b[i]]
- > }' urfile | sort -k1,1n
- 1521508400 192.168.1.19 00:01:00:e1:78:38 valid 120
- 1521509079 192.168.1.91 00:01:00:27:b1:a7 valid 90
- 1521509738 192.168.1.12 00:01:00:f5:41:ba valid 220
- 1521509797 192.168.1.11 00:01:00:f5:41:bb bad
- [root@hk tmp]#
- [root@hk tmp]#
复制代码 |
评分
-
查看全部评分
|