【发布时间】:2015-11-05 22:59:42
【问题描述】:
我的日志文件有很多行,下面的行是它的示例 我有 2 把钥匙。第一个键是子。 Id (1112222222) 第二个键是会话 id (xxx.apn.com;2418561818;846;60034)。
sub Id 是已知的,我需要创建一个大的 shell 命令来搜索此 sub id 的会话 id,然后在文件中搜索具有这些键之一或两者的所有行。例如下面一行包含会话 id 和子 id 对。
úú 3 [ +548] EPC_Log: bi_tspSequenceId=1; i_tspSeverity=6; vc_MessageInformation=CCR received. SessionId: xxx.apn.com;2418561818;846;60034, SubsId: 1112222222, IpAddr: 1.1.1.1, Protocol: Gx, RequestType: Create, APN: apn.com, Event-Trigger: ;i_Priority=6úúûû TelORB: Tue Aug 11 12:26:05 2015, Host:úú Tue Aug 11 12:26:18 2015
输入示例
úú 3 [ +548] EPC_Log: bi_tspSequenceId=1; i_tspSeverity=6; vc_MessageInformation=CCR received. SessionId: xxx.apn.com;2418561818;846;60034, SubsId: 1112222222, IpAddr: 1.1.1.1, Protocol: Gx, RequestType: Create, APN: apn.com, Event-Trigger: ;i_Priority=6úúûû TelORB: Tue Aug 11 12:26:05 2015, Host:úú Tue Aug 11 12:26:18 2015
úú 3 [ +548] EPC_Log: bi_tspSequenceId=1; i_tspSeverity=6; vc_MessageInformation=CCA received. SessionId: xxx.apn.com;2418561818;846;60034, SubsId: 1112222222, IpAddr: 1.1.1.1, Protocol: Gx, RequestType: Create, APN: apn.com, Event-Trigger: ;i_Priority=6úúûû TelORB: Tue Aug 11 12:26:05 2015, Host:úú Tue Aug 11 12:26:18 2015
úú 3 [ +548] EPC_Log: bi_tspSequenceId=1; i_tspSeverity=6; vc_MessageInformation=CCR received. SessionId: yyy.apn.com;2418561818;846;60034, SubsId: 1113333333, IpAddr: 1.1.1.1, Protocol: Gx, RequestType: Create, APN: apn.com, Event-Trigger: ;i_Priority=6úúûû TelORB: Tue Aug 11 12:26:05 2015, Host:úú Tue Aug 11 12:26:18 2015
úú 3 [ +548] EPC_Log: bi_tspSequenceId=1; i_tspSeverity=6; vc_MessageInformation=CCA received. SessionId: yyy.apn.com;2418561818;846;60034, SubsId: 1112222222, IpAddr: 1.1.1.1, Protocol: Gx, RequestType: Create, APN: apn.com, Event-Trigger: ;i_Priority=6úúûû TelORB: Tue Aug 11 12:26:05 2015, Host:úú Tue Aug 11 12:26:18 2015
输出示例
úú 3 [ +548] EPC_Log: bi_tspSequenceId=1; i_tspSeverity=6; vc_MessageInformation=CCR received. SessionId: xxx.apn.com;2418561818;846;60034, SubsId: 1112222222, IpAddr: 1.1.1.1, Protocol: Gx, RequestType: Create, APN: apn.com, Event-Trigger: ;i_Priority=6úúûû TelORB: Tue Aug 11 12:26:05 2015, Host:úú Tue Aug 11 12:26:18 2015
úú 3 [ +548] EPC_Log: bi_tspSequenceId=1; i_tspSeverity=6; vc_MessageInformation=CCA received. SessionId: xxx.apn.com;2418561818;846;60034, SubsId: 1112222222, IpAddr: 1.1.1.1, Protocol: Gx, RequestType: Create, APN: apn.com, Event-Trigger: ;i_Priority=6úúûû TelORB: Tue Aug 11 12:26:05 2015, Host:úú Tue Aug 11 12:26:18 2015
úú 3 [ +548] EPC_Log: bi_tspSequenceId=1; i_tspSeverity=6; vc_MessageInformation=CCA received. SessionId: yyy.apn.com;2418561818;846;60034, SubsId: 1112222222, IpAddr: 1.1.1.1, Protocol: Gx, RequestType: Create, APN: apn.com, Event-Trigger: ;i_Priority=6úúûû TelORB: Tue Aug 11 12:26:05 2015, Host:úú Tue Aug 11 12:26:18 2015
【问题讨论】:
-
请提供样本输入数据和相应的输出
-
你可以在更新样本后在正文中查看