大家好!
有个问题比较疑惑,不知道怎么处理了,还请指点指点。
我有一个文件,内容如下:
----------messages----------------
Jan 9 05:30:13 linux-lhkq sshd[5118]: Accepted keyboard-interactive/pam for root from 192.168.44.1 port 2394 ssh2
Jan 9 06:01:25 linux-lhkq syslog-ng[3412]: STATS: dropped 0
Jan 9 06:01:38 linux-lhkq zmd: ShutdownManager (WARN): Preparing to sleep...
Jan 9 06:01:38 linux-lhkq zmd: ShutdownManager (WARN): Going to sleep, waking up at 01/10/2011 04:51:38
Jan 9 06:31:00 linux-lhkq kernel: ISO 9660 Extensions: Microsoft Joliet Level 3
Jan 9 06:31:00 linux-lhkq kernel: ISO 9660 Extensions: RRIP_1991A
Jan 9 06:56:50 linux-lhkq shadow[9035]: group is unknown - group=wwwadmin, by=0
Jan 9 06:56:50 linux-lhkq shadow[9036]: default group changed - account=wwwrun, uid=30, gid=8, old gid=8, by=0
Jan 9 06:56:50 linux-lhkq shadow[9037]: shell changed - account=wwwrun, uid=30, shell=/bin/false, old shell=/bin/false, by=0
Jan 9 07:01:25 linux-lhkq syslog-ng[3412]: STATS: dropped 0
----------apache-log----------------
127.0.0.1 - - [09/Jan/2011:07:00:16 +0800] "GET / HTTP/1.0" 403 1045 "-" "ApacheBench/2.0.40-dev"
127.0.0.1 - - [09/Jan/2011:07:00:16 +0800] "GET / HTTP/1.0" 403 1045 "-" "ApacheBench/2.0.40-dev"
127.0.0.1 - - [09/Jan/2011:07:00:16 +0800] "GET / HTTP/1.0" 403 1045 "-" "ApacheBench/2.0.40-dev"
127.0.0.1 - - [09/Jan/2011:07:00:16 +0800] "GET / HTTP/1.0" 403 1045 "-" "ApacheBench/2.0.40-dev"
127.0.0.1 - - [09/Jan/2011:07:00:06 +0800] "GET / HTTP/1.0" 403 1045 "-" "ApacheBench/2.0.40-dev"
127.0.0.1 - - [09/Jan/2011:07:00:16 +0800] "GET / HTTP/1.0" 403 1045 "-" "ApacheBench/2.0.40-dev"
######################################################
###############mail-log###############################
Jan 3 19:21:17 linux-lhkq postfix/postfix-script: starting the Postfix mail system
Jan 3 19:21:17 linux-lhkq postfix/master[4648]: daemon started -- version 2.2.9, configuration /etc/postfix
Jan 4 14:16:41 linux-lhkq postfix/postfix-script: starting the Postfix mail system
Jan 4 14:16:42 linux-lhkq postfix/master[4632]: daemon started -- version 2.2.9, configuration /etc/postfix
Jan 4 15:52:46 linux-lhkq postfix/master[4632]: terminating on signal 15
Jan 7 19:19:58 linux-lhkq postfix/postfix-script: starting the Postfix mail system
Jan 7 19:19:59 linux-lhkq postfix/master[4628]: daemon started -- version 2.2.9, configuration /etc/postfix
Jan 7 19:24:37 linux-lhkq postfix/master[4628]: terminating on signal 15
Jan 9 05:01:32 linux-lhkq postfix/postfix-script: starting the Postfix mail system
Jan 9 05:01:33 linux-lhkq postfix/master[4573]: daemon started -- version 2.2.9, configuration /etc/postfix
我想把各个块下面的内容输出到一个列表,不知道怎么操作。
结果如:
@messages的内容是 messages段下面(apache-log上面)的内容
@apache-log的内容为apache-log与mail-log之间的内容
.......
先谢谢了!
2011年1月6日星期四
[PerlChina] 一个关于配置刷选的问题
订阅:
博文评论 (Atom)
没有评论:
发表评论