【发布时间】:2017-05-08 12:19:31
【问题描述】:
我有一个很大的日志文件,我只需要两列。以下是日志文件中的一行:
[2017-05-02 13:02:25,986] [AJPRequestHandler-HTTPThreadGroup-10239] SID0003457|10.22.165.22|13|16|FAILED|500||<?xml version="1.0" encoding="UTF-8"?> <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Header><ns1:SessionType xmlns:ns1="http://tough.example.com/webservices">STATELESS</ns1:SessionType><ns2:UsernameToken xmlns:ns2="http://tough.example.com/webservices">ocore-intg_w
w@example.com</ns2:UsernameToken><ns3:PasswordText xmlns:ns3="http://tough.example.com/webservices">UdontsoiuN</ns3:PasswordText></S:Header><S:Body><getExternalPortalUserElement xmlns="http://ws.web.
tough1.tough.example.com/"><emailAddress>park.phannon23@example.com</emailAddress></getExternalPortalUserElement></S:Body></S:Envelope>|{http://ws.web.tough1.tough.example.com/}getExternalPortalUserElement|<n
s1:Header xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"><ns1:SessionType xmlns:ns1="http://tough.example.com/webservices">STATELESS</ns1:SessionType><ns2:UsernameToken xmlns:ns2="http://tough.example.com/webservices">ocore-intg_ww@example.com</ns2:UsernameToken><ns3:PasswordText xmlns:ns3="http://tough.example.com/webservices">UiojdfdoiNN</ns3:PasswordText></ns1:Header>|0|620|null
我只需要一个单独的文件中的输出,其中包含来自日志文件的日期,即第一列和电子邮件地址,就像这样
2017-05-02 13:02:25 park.phannon23@example.com
谁能帮忙,我浏览了多个网站,但无法像上面那样格式化。
【问题讨论】:
-
向我们展示您的代码。你试过什么?你有什么问题?
-
欢迎来到 StackOverflow。这不是免费的编码服务。请使用tour 并阅读How to Ask。
-
“我只粘贴日志文件中的一行” 但是你贴了四行文字,所以无法猜测原始数据是什么样子的。
-
@Picard 大家都这么说,但从下面的多个答案中可以看出,只要人们迫切需要积分,那显然是。
-
@123:OP 继续同样的事情,没有尝试任何东西,不会发布任何答案。我很确定。