- 论坛徽章:
- 2
|
本帖最后由 kakaliu 于 2013-08-23 10:00 编辑
用vi 查看日志的时候发现有些行 内容很长 在VI中查看特别不方便 大致内容如下
{history={id=272707330, returnState=null, businessId=879, linkId=null, gatewayMessageId=null}, map={messageId=-8491669862039930271, phone=13750416569, returnChannelTime=2013-08-21 23:51:00.0, returnConnTime=2013-08-21 23:51:00.0, returnRspCode=0, returnRspDesc=MI:0024, returnState=0}, table=t_sms_mt_history201308},{history={id=272571083, returnState=null, businessId=879, linkId=null, gatewayMessageId=null}, map={messageId=-8491669312283684446, phone=13798830345, returnChannelTime=2013-08-21 23:51:00.0, returnConnTime=2013-08-21 23:51:00.0, returnRspCode=0, returnRspDesc=MI:0024, returnState=0}, table=t_sms_mt_history201308}, {history=xxx}
首先我想分段成每行行首为这样的格式
{history={id=272707330, returnState=null, businessId=879, linkId=null, gatewayMessageId=null}, map={messageId=-8491669862039930271, phone=13750416569, returnChannelTime=2013-08-21 23:51:00.0, returnConnTime=2013-08-21 23:51:00.0, returnRspCode=0, returnRspDesc=MI:0024, returnState=0}, table=t_sms_mt_history201308},
{history={id=272571083, returnState=null, businessId=879, linkId=null, gatewayMessageId=null}, map={messageId=-8491669312283684446, phone=13798830345, returnChannelTime=2013-08-21 23:51:00.0, returnConnTime=2013-08-21 23:51:00.0, returnRspCode=0, returnRspDesc=MI:0024, returnState=0}, table=t_sms_mt_history201308},
其次在用awk 来过滤我想要的字段 如下所示
id=272707330,businessId=879,messageId=-8491669862039930271, phone=13750416569, returnChannelTime=2013-08-21 23:51:00.0, returnConnTime=2013-08-21 23:51:00.0, returnRspCode=0
id=272571083,businessId=879,messageId=-8491669312283684446, phone=13798830345, returnChannelTime=2013-08-21 23:51:00.0, returnConnTime=2013-08-21 23:51:00.0, returnRspCode=0
请各位大神帮忙 |
|