- 论坛徽章:
- 0
|
需求:读取ftp的log文件xferlog ,找出20分钟以内被上传的文件,xferlog格式如下:
Wed Oct 11 09:19:10 2006 1 hostname 2286 /var/www/htdocs/im/images/sh/bj/yakong_061011.gif b _ i r webmaster ftp 0 * c
Wed Oct 11 09:36:10 2006 1 hostname 4257 /var/www/htdocs/im/images/sh/bj/kaituoreli061011.gif b _ i r webmaster ftp 0 * c
Wed Oct 11 09:42:39 2006 1 hostname 1553 /var/www/htdocs/im/images/sh/hz/zhongmao061011.gif b _ i r webmaster ftp 0 * c
Wed Oct 11 10:14:13 2006 1 hostname 1258 /var/www/htdocs/im/images/sh/sy/baoshen061011.gif b _ i r webmaster ftp 0 * c
Wed Oct 11 10:31:58 2006 1 hostname 14486 /var/www/cooperate/sgmcampus/shfy.htm a _ i r webmaster ftp 0 * c
Wed Oct 11 10:31:58 2006 1 hostname 13229 /var/www/cooperate/sgmcampus/shty.htm a _ i r webmaster ftp 0 * c
Wed Oct 11 10:56:52 2006 1 hostname 895 /var/www/htdocs/im/images/sh/sz/emerson061011.gif b _ i r webmaster ftp 0 * c
Wed Oct 11 11:33:48 2006 1 hostname 3202 /var/www/htdocs/im/images/sh/sh/beier060927.gif b _ i r webmaster ftp 0 * c
Wed Oct 11 11:53:06 2006 1 hostname 2207 /var/www/htdocs/im/images/sh/bj/gzrc061011.gif b _ i r webmaster ftp 0 * c
Wed Oct 11 11:55:03 2006 1 hostname 1220 /var/www/htdocs/im/images/sh/hz/xyt061011.gif b _ i r webmaster ftp 0 * c
每一行的前5个字段就是时间,因为log里时间是“不连续”的,用date输出一个字符串再grep 或者sed行不通。。。怎么搞啊? |
|