解析日志文件 [英] Parsing a Log File

查看:63
本文介绍了解析日志文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我的新perl

i必须从网络中解析日志文件


,格式如下:


开始时间:2-16-07 11:27a

从服务器''bliblibli''恢复客户''blablabla''的文件。

恢复:总计恢复所需的估计磁盘空间为3 MB。

将D:\ X \ Y \中的5个文件恢复到E:\restore

请求5个文件( s),这可能需要一段时间......

E:\\\ topore \ blabla \ blablabla.bla

E:\\\ topore \ blabla \ blablabla.bli

E:\\\ topore \ blabla \ blablabla.blu

E:\\\ topore \ lablabla \ blablabla.ble

E:\ ltore; \\ blabla \ blablabla.blo

从NSR服务器收到5个文件''blablabla''

恢复完成时间: 2月16日星期五11:30:52


和数据,我需要:

开始时间,完成时间,客户名称,服务器名称,总文件和磁盘空间


i有正则表达式,grep,split的问题。有人可以帮助我吗?

thx before =)

解决方案

到目前为止你尝试了什么?



你到目前为止尝试过什么?



开始时间:2-16-07 11:27a

从服务器''bliblibli'恢复客户''blablabla''的文件'。

恢复:恢复所需的总磁盘空间估计为3 MB。

将D:\ X \ Y \中的5个文件恢复到E:\恢复

---->这是oke ..


然后我怎样才能到最后一行获得完成日期,

因为每个文件都有不同要恢复的文件数量。(在这个例子中是5个文件)

i没有创建循环的想法


让我们看看到目前为止你写的perl代码。

hello im new with perl
i must do parse log file from networker

with format look like this :

Start time: 2-16-07 11:27a
Recovering files of client ''blablabla'' from server ''bliblibli''.
Recover: Total estimated disk space needed for recover is 3 MB.
Recovering 5 files within D:\X\Y\ into E:\restore
Requesting 5 file(s), this may take a while...
E:\restore\blabla\blablabla.bla
E:\restore\blabla\blablabla.bli
E:\restore\blabla\blablabla.blu
E:\restore\blabla\blablabla.ble
E:\restore\blabla\blablabla.blo
Received 5 file(s) from NSR server ''blablabla''
Recover completion time: Fri Feb 16 11:30:52 2007

and the data,i need:
start time,completion time,client name,server name,total file,and disk space

i have problem with regex,grep,split..is anyone can help me?
thx before =)

解决方案

What have you tried so far?


What have you tried so far?

Start time: 2-16-07 11:27a
Recovering files of client ''blablabla'' from server ''bliblibli''.
Recover: Total estimated disk space needed for recover is 3 MB.
Recovering 5 files within D:\X\Y\ into E:\restore
----> this is oke..


and then how can i go to the last line to get the completion date,
because every file has different amount of files to recover.(in this example 5 files)
i dont have idea to make the loop


Lets see the perl code you have written so far.


这篇关于解析日志文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆