免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: kkshaq
打印 上一主题 下一主题

[文本处理] sed如何根据需求截取区间内容(工作需要)求大神指导 [复制链接]

论坛徽章:
1
2015亚冠之浦和红钻
日期:2015-05-26 14:37:09
11 [报告]
发表于 2016-08-09 11:06 |只看该作者
本帖最后由 kkshaq 于 2016-08-09 13:06 编辑

回复 10# moperyblue


    我的错啊,哥们,全部的代码在这里,希望哥们能够指点一下啊。

论坛徽章:
28
15-16赛季CBA联赛之八一
日期:2016-02-22 19:10:4215-16赛季CBA联赛之深圳
日期:2016-12-01 10:34:0415-16赛季CBA联赛之新疆
日期:2016-12-07 10:24:2915-16赛季CBA联赛之同曦
日期:2016-12-15 12:06:43CU十四周年纪念徽章
日期:2016-12-18 13:03:4415-16赛季CBA联赛之吉林
日期:2017-01-03 15:52:2515-16赛季CBA联赛之辽宁
日期:2017-01-04 14:58:2415-16赛季CBA联赛之辽宁
日期:2017-01-15 09:42:512016科比退役纪念章
日期:2017-02-06 17:21:50黑曼巴
日期:2017-02-10 15:46:1215-16赛季CBA联赛之上海
日期:2017-03-18 10:14:5415-16赛季CBA联赛之青岛
日期:2017-03-18 22:00:44
12 [报告]
发表于 2016-08-09 11:14 |只看该作者
本帖最后由 moperyblue 于 2016-08-09 11:18 编辑

回复 11# kkshaq

你的原始数据文件是unix格式吗? 如果否 请先dos2unix file

awk -F\\n -vRS=  '$5{print;print""}' file
  1. -------------------------------------------------------------------------------
  2. SES Actions:
  3. -------------------------------------------------------------------------------
  4.    Share [%]    Total Value
  5.        44.96       58 pushTokenMgmt
  6.        34.11       44 pushAppMessage
  7.        16.28       21 APNSNotification
  8.         3.10        4 sppPushMessage
  9.         1.55        2 identitiesMapMessage

  10. -------------------------------------------------------------------------------
  11. Error Codes of sppPushMessage:
  12. -------------------------------------------------------------------------------
  13.    Share [%]    Total Value
  14.       100.00        2 VALIDATION_FAILURE

  15. -------------------------------------------------------------------------------
  16. Status Codes of APNSNotification:
  17. -------------------------------------------------------------------------------
  18.    Share [%]    Total Value
  19.        90.48       19 0
  20.         9.52        2 21

  21. -------------------------------------------------------------------------------
  22. ServiceName of PushAppMessage:
  23. -------------------------------------------------------------------------------
  24.    Share [%]    Total Value
  25.        33.33       10 vvm
  26.        20.00        6 vowifi
  27.        10.00        3 gen,icloudvowifi,vowifi
  28.         6.67        2 chan1,chan2
  29.         6.67        2 icloudvowifi
  30.         6.67        2 gen
  31.         6.67        2 mca
  32.         3.33        1 testingchannel,vowifi
  33.         3.33        1 conn_mgr,vvm
  34.         3.33        1 multi-sim

  35. -------------------------------------------------------------------------------
  36. ServiceName of SppPushMessage:
  37. -------------------------------------------------------------------------------
  38.    Share [%]    Total Value
  39.        50.00        2 undefined
  40.        50.00        2 vvm

  41. -------------------------------------------------------------------------------
  42. ServiceName of APNSNotification:
  43. -------------------------------------------------------------------------------
  44.    Share [%]    Total Value
  45.        38.10        8 vowifi
  46.        23.81        5 icloudvowifi
  47.        14.29        3 gen
  48.         4.76        1 chan2
  49.         4.76        1 chan1
  50.         4.76        1 vvm
  51.         4.76        1 conn_mgr
  52.         4.76        1 multi-sim
复制代码

论坛徽章:
1
2015亚冠之浦和红钻
日期:2015-05-26 14:37:09
13 [报告]
发表于 2016-08-09 11:38 |只看该作者
本帖最后由 kkshaq 于 2016-08-09 13:07 编辑

回复 12# moperyblue


哥们,我知道什么原因了!!不好意思,还是我代码没有把开头的地方写全的原因   少写了  Start and End Time  和Deault。。最后截取的结果吗,Start and End time 越是需要得到的。。。不知道怎么改啊[code]Start and End Time:

论坛徽章:
28
15-16赛季CBA联赛之八一
日期:2016-02-22 19:10:4215-16赛季CBA联赛之深圳
日期:2016-12-01 10:34:0415-16赛季CBA联赛之新疆
日期:2016-12-07 10:24:2915-16赛季CBA联赛之同曦
日期:2016-12-15 12:06:43CU十四周年纪念徽章
日期:2016-12-18 13:03:4415-16赛季CBA联赛之吉林
日期:2017-01-03 15:52:2515-16赛季CBA联赛之辽宁
日期:2017-01-04 14:58:2415-16赛季CBA联赛之辽宁
日期:2017-01-15 09:42:512016科比退役纪念章
日期:2017-02-06 17:21:50黑曼巴
日期:2017-02-10 15:46:1215-16赛季CBA联赛之上海
日期:2017-03-18 10:14:5415-16赛季CBA联赛之青岛
日期:2017-03-18 22:00:44
14 [报告]
发表于 2016-08-09 11:54 |只看该作者
本帖最后由 moperyblue 于 2016-08-09 12:04 编辑

回复 13# kkshaq
  1. awk -F\\n -vRS= '/Start and/,/End Time/{s=s?s RS $0:$0;print s;print""}$5{print;print""}' file
  2. sed -r '/Start and/,/End Time/{/^\s+End Time/G;b};/-/{:a;$!N;/\n$/!{$!ba};s/\n/&/5;t};d' file
  3. sed -r '/Start and/,/End Time/{/^\s+End Time/G;b};/-/{:a;$!N;/\n$/!{$!ba};/Total Value.*\n\s+\S+/b};d' file
复制代码

论坛徽章:
307
程序设计版块每周发帖之星
日期:2016-04-08 00:41:33操作系统版块每日发帖之星
日期:2015-09-02 06:20:00每日论坛发贴之星
日期:2015-09-02 06:20:00程序设计版块每日发帖之星
日期:2015-09-04 06:20:00每日论坛发贴之星
日期:2015-09-04 06:20:00每周论坛发贴之星
日期:2015-09-06 22:22:00程序设计版块每日发帖之星
日期:2015-09-09 06:20:00程序设计版块每日发帖之星
日期:2015-09-19 06:20:00程序设计版块每日发帖之星
日期:2015-09-20 06:20:00每日论坛发贴之星
日期:2015-09-20 06:20:00程序设计版块每日发帖之星
日期:2015-09-22 06:20:00程序设计版块每日发帖之星
日期:2015-09-24 06:20:00
15 [报告]
发表于 2016-08-09 11:55 |只看该作者
  1. perl -00nle 'next if(/\A-+\z/);print if(!/Value\s*\z/)' f
复制代码

论坛徽章:
1
2015亚冠之浦和红钻
日期:2015-05-26 14:37:09
16 [报告]
发表于 2016-08-09 12:36 |只看该作者
本帖最后由 kkshaq 于 2016-08-09 12:38 编辑

回复 14# moperyblue

这个是所有的log 代码。。你刚才发的那些sed命令貌似又不行了啊。能说说是什么原因吗??大神,按理说应该都可以啊。不然感觉不太灵活啊


  1. Start and End Time:
  2. -------------------------------------------------------------------------------
  3.    Start Time:  2016-08-08 18:43:11.126569426
  4.    End Time:    2016-08-09 04:50:10.248093935
  5.    
  6. -------------------------------------------------------------------------------
  7. Default:
  8. -------------------------------------------------------------------------------
  9.    Share [%]    Total Value
  10.    
  11. -------------------------------------------------------------------------------
  12. SES Actions:
  13. -------------------------------------------------------------------------------
  14.    Share [%]    Total Value
  15.        44.96       58 pushTokenMgmt
  16.        34.11       44 pushAppMessage
  17.        16.28       21 APNSNotification
  18.         3.10        4 sppPushMessage
  19.         1.55        2 identitiesMapMessage
  20.    
  21. -------------------------------------------------------------------------------
  22. Status Codes of getAuthentication:
  23. -------------------------------------------------------------------------------
  24.    Share [%]    Total Value
  25.    
  26. -------------------------------------------------------------------------------
  27. Status Codes of postChallenge:
  28. -------------------------------------------------------------------------------
  29.    Share [%]    Total Value
  30.    
  31. -------------------------------------------------------------------------------
  32. Status Codes of getEntitlement:
  33. -------------------------------------------------------------------------------
  34.    Share [%]    Total Value
  35.    
  36. -------------------------------------------------------------------------------
  37. Status Codes of getPhoneNumber:
  38. -------------------------------------------------------------------------------
  39.    Share [%]    Total Value
  40.    
  41. -------------------------------------------------------------------------------
  42. Status Codes of getPhoneServicesAccountStatus:
  43. -------------------------------------------------------------------------------
  44.    Share [%]    Total Value
  45.    
  46. -------------------------------------------------------------------------------
  47. Status Codes of getProvisioning:
  48. -------------------------------------------------------------------------------
  49.    Share [%]    Total Value
  50.    
  51. -------------------------------------------------------------------------------
  52. Status Codes of setProvisioning:
  53. -------------------------------------------------------------------------------
  54.    Share [%]    Total Value
  55.    
  56. -------------------------------------------------------------------------------
  57. Status Codes of disablePushNotification:
  58. -------------------------------------------------------------------------------
  59.    Share [%]    Total Value
  60.    
  61. -------------------------------------------------------------------------------
  62. Status Codes of enablePushNotification:
  63. -------------------------------------------------------------------------------
  64.    Share [%]    Total Value
  65.    
  66. -------------------------------------------------------------------------------
  67. Status Codes of updatePushToken:
  68. -------------------------------------------------------------------------------
  69.    Share [%]    Total Value
  70.    
  71. -------------------------------------------------------------------------------
  72. Status Codes of getSubscriptionAndUsageStatus:
  73. -------------------------------------------------------------------------------
  74.    Share [%]    Total Value
  75.    
  76. -------------------------------------------------------------------------------
  77. Status Codes of setEntitlement:
  78. -------------------------------------------------------------------------------
  79.    Share [%]    Total Value
  80.    
  81. -------------------------------------------------------------------------------
  82. Status Codes of getPreferredRoamingNetworks:
  83. -------------------------------------------------------------------------------
  84.    Share [%]    Total Value
  85.    
  86. -------------------------------------------------------------------------------
  87. Status Codes of getSIMStatus:
  88. -------------------------------------------------------------------------------
  89.    Share [%]    Total Value
  90.    
  91. -------------------------------------------------------------------------------
  92. Status Codes of signUpForSIMService:
  93. -------------------------------------------------------------------------------
  94.    Share [%]    Total Value
  95.    
  96. -------------------------------------------------------------------------------
  97. Status Codes of serviceEntitlementStatus:
  98. -------------------------------------------------------------------------------
  99.    Share [%]    Total Value
  100.    
  101. -------------------------------------------------------------------------------
  102. Status Codes of manageSteering:
  103. -------------------------------------------------------------------------------
  104.    Share [%]    Total Value
  105.    
  106. -------------------------------------------------------------------------------
  107. Status Codes of authorizeDevice:
  108. -------------------------------------------------------------------------------
  109.    Share [%]    Total Value
  110.    
  111. -------------------------------------------------------------------------------
  112. Status Codes of manageConnectivity:
  113. -------------------------------------------------------------------------------
  114.    Share [%]    Total Value
  115.    
  116. -------------------------------------------------------------------------------
  117. Status Codes of manageService:
  118. -------------------------------------------------------------------------------
  119.    Share [%]    Total Value
  120.    
  121. -------------------------------------------------------------------------------
  122. Status Codes of registeredMsisdn:
  123. -------------------------------------------------------------------------------
  124.    Share [%]    Total Value
  125.    
  126. -------------------------------------------------------------------------------
  127. Status Codes of manageLocationAndTc:
  128. -------------------------------------------------------------------------------
  129.    Share [%]    Total Value
  130.    
  131. -------------------------------------------------------------------------------
  132. Status Codes of getMsisdn:
  133. -------------------------------------------------------------------------------
  134.    Share [%]    Total Value
  135.    
  136. -------------------------------------------------------------------------------
  137. Status Codes of _3gppAuthChallenge:
  138. -------------------------------------------------------------------------------
  139.    Share [%]    Total Value
  140.    
  141. -------------------------------------------------------------------------------
  142. Status Codes of _3gppAuthentication:
  143. -------------------------------------------------------------------------------
  144.    Share [%]    Total Value
  145.    
  146. -------------------------------------------------------------------------------
  147. Status Codes of managePushToken:
  148. -------------------------------------------------------------------------------
  149.    Share [%]    Total Value
  150.    
  151. -------------------------------------------------------------------------------
  152. Status Codes of registeredDevices:
  153. -------------------------------------------------------------------------------
  154.    Share [%]    Total Value
  155.    
  156. -------------------------------------------------------------------------------
  157. Error Codes of pushTokenMgmt:
  158. -------------------------------------------------------------------------------
  159.    Share [%]    Total Value
  160.    
  161. -------------------------------------------------------------------------------
  162. Error Codes of sppPushMessage:
  163. -------------------------------------------------------------------------------
  164.    Share [%]    Total Value
  165.       100.00        2 VALIDATION_FAILURE
  166.    
  167. -------------------------------------------------------------------------------
  168. Gcm Return Codes of sppPushMessage:
  169. -------------------------------------------------------------------------------
  170.    Share [%]    Total Value
  171.    
  172. -------------------------------------------------------------------------------
  173. Status Codes of APNSNotification:
  174. -------------------------------------------------------------------------------
  175.    Share [%]    Total Value
  176.        90.48       19 0
  177.         9.52        2 21
  178.    
  179. -------------------------------------------------------------------------------
  180. Status Codes of EmailOutgoing:
  181. -------------------------------------------------------------------------------
  182.    Share [%]    Total Value
  183.    
  184. -------------------------------------------------------------------------------
  185. Status Codes of GcmRedelivery:
  186. -------------------------------------------------------------------------------
  187.    Share [%]    Total Value
  188.    
  189. -------------------------------------------------------------------------------
  190. Records of XforwardedFor:
  191. -------------------------------------------------------------------------------
  192.    Share [%]    Total Value
  193.       100.00        4 10.175.147.226
  194.    
  195. -------------------------------------------------------------------------------
  196. Redelivery Times of GCM Message:
  197. -------------------------------------------------------------------------------
  198.    Share [%]    Total Value
  199.    
  200. -------------------------------------------------------------------------------
  201. Redelivery Times of APNS Message:
  202. -------------------------------------------------------------------------------
  203.    Share [%]    Total Value
  204.       100.00       21 0
  205.    
  206. -------------------------------------------------------------------------------
  207. Redelivery Times of Email Message:
  208. -------------------------------------------------------------------------------
  209.    Share [%]    Total Value
  210.    
  211. -------------------------------------------------------------------------------
  212. Status Code of APNS Response:
  213. -------------------------------------------------------------------------------
  214.    Share [%]    Total Value
  215.    
  216. -------------------------------------------------------------------------------
  217. Error Code of updateApnsTokenStatus:
  218. -------------------------------------------------------------------------------
  219.    Share [%]    Total Value
  220.    
  221. -------------------------------------------------------------------------------
  222. Error Code of queryApnsToken:
  223. -------------------------------------------------------------------------------
  224.    Share [%]    Total Value
  225.    
  226. -------------------------------------------------------------------------------
  227. ServiceName of QueryApnsToken:
  228. -------------------------------------------------------------------------------
  229.    Share [%]    Total Value
  230.    
  231. -------------------------------------------------------------------------------
  232. ServiceName of PushAppMessage:
  233. -------------------------------------------------------------------------------
  234.    Share [%]    Total Value
  235.        33.33       10 vvm
  236.        20.00        6 vowifi
  237.        10.00        3 gen,icloudvowifi,vowifi
  238.         6.67        2 chan1,chan2
  239.         6.67        2 icloudvowifi
  240.         6.67        2 gen
  241.         6.67        2 mca
  242.         3.33        1 testingchannel,vowifi
  243.         3.33        1 conn_mgr,vvm
  244.         3.33        1 multi-sim
  245.    
  246. -------------------------------------------------------------------------------
  247. ServiceName of SppPushMessage:
  248. -------------------------------------------------------------------------------
  249.    Share [%]    Total Value
  250.        50.00        2 undefined
  251.        50.00        2 vvm
  252.    
  253. -------------------------------------------------------------------------------
  254. ServiceName of APNSNotification:
  255. -------------------------------------------------------------------------------
  256.    Share [%]    Total Value
  257.        38.10        8 vowifi
  258.        23.81        5 icloudvowifi
  259.        14.29        3 gen
  260.         4.76        1 chan2
  261.         4.76        1 chan1
  262.         4.76        1 vvm
  263.         4.76        1 conn_mgr
  264.         4.76        1 multi-sim
  265.    
  266. -------------------------------------------------------------------------------
  267. ServiceName of PushTokenMgmt:
  268. -------------------------------------------------------------------------------
  269.    Share [%]    Total Value
  270.        29.09       16 vowifi
  271.        18.18       10 gen
  272.        14.55        8 icloudvowifi
  273.        12.73        7 vvm
  274.        10.91        6 mca
  275.         3.64        2 chan2
  276.         3.64        2 chan1
  277.         3.64        2 multi-sim
  278.         3.64        2 conn_mgr
  279.    
  280. -------------------------------------------------------------------------------
  281. Status code of samAuthorize:
  282. -------------------------------------------------------------------------------
  283.    Share [%]    Total Value
  284.    
  285. -------------------------------------------------------------------------------
  286. Status code of samExchangeToken:
  287. -------------------------------------------------------------------------------
  288.    Share [%]    Total Value
  289.    
  290. -------------------------------------------------------------------------------
  291. Status code of samRefreshToken:
  292. -------------------------------------------------------------------------------
  293.    Share [%]    Total Value
  294.    
  295. -------------------------------------------------------------------------------
  296. Status code of samValidateToken:
  297. -------------------------------------------------------------------------------
  298.    Share [%]    Total Value
  299.    
  300. -------------------------------------------------------------------------------
  301. Status code of samRevokeToken:
  302. -------------------------------------------------------------------------------
  303.    Share [%]    Total Value
  304.    
  305. -------------------------------------------------------------------------------
  306. Error Codes of samAuthorize:
  307. -------------------------------------------------------------------------------
  308.    Share [%]    Total Value
  309.    
  310. -------------------------------------------------------------------------------
  311. Error Codes of samExchangeToken:
  312. -------------------------------------------------------------------------------
  313.    Share [%]    Total Value
  314.    
  315. -------------------------------------------------------------------------------
  316. Error Codes of samRefreshToken:
  317. -------------------------------------------------------------------------------
  318.    Share [%]    Total Value
  319.    
  320. -------------------------------------------------------------------------------
  321. Error Codes of samValidateToken:
  322. -------------------------------------------------------------------------------
  323.    Share [%]    Total Value
  324.    
  325. -------------------------------------------------------------------------------
  326. Error Codes of samRevokeToken:
  327. -------------------------------------------------------------------------------
  328.    Share [%]    Total Value
  329.    
  330. -------------------------------------------------------------------------------
  331. Status code of ValidateSipUsernameAndDigest:
  332. -------------------------------------------------------------------------------
  333.    Share [%]    Total Value
  334.    
  335. -------------------------------------------------------------------------------
  336. Error code of ValidateSipUsernameAndDigest:
  337. -------------------------------------------------------------------------------
  338.    Share [%]    Total Value

复制代码

论坛徽章:
5
2015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:50:282015年亚洲杯之朝鲜
日期:2015-03-13 22:47:33IT运维版块每日发帖之星
日期:2016-01-09 06:20:00IT运维版块每周发帖之星
日期:2016-03-07 16:27:44
17 [报告]
发表于 2016-08-09 12:52 |只看该作者
难点在于问题的描述,而不是问题本身。

论坛徽章:
1
2015亚冠之浦和红钻
日期:2015-05-26 14:37:09
18 [报告]
发表于 2016-08-09 13:02 |只看该作者
本帖最后由 kkshaq 于 2016-08-09 13:06 编辑

回复 17# blackold


看来我的表达能力堪忧啊,汗啊!希望各位大神,能够帮忙解决一下。。我重新表述一下,谢谢

原始的log代码
  1. Start and End Time:
  2. -------------------------------------------------------------------------------
  3.    Start Time:  2016-08-08 18:43:11.126569426
  4.    End Time:    2016-08-09 04:50:10.248093935
  5.       
  6. -------------------------------------------------------------------------------
  7. SES Actions:
  8. -------------------------------------------------------------------------------
  9.    Share [%]    Total Value
  10.        44.96       58 pushTokenMgmt
  11.        34.11       44 pushAppMessage
  12.        16.28       21 APNSNotification
  13.         3.10        4 sppPushMessage
  14.         1.55        2 identitiesMapMessage
  15.    
  16. -------------------------------------------------------------------------------
  17. Status Codes of getAuthentication:
  18. -------------------------------------------------------------------------------
  19.    Share [%]    Total Value
  20.    
  21. -------------------------------------------------------------------------------
  22. Status Codes of postChallenge:
  23. -------------------------------------------------------------------------------
  24.    Share [%]    Total Value
  25.    
  26. -------------------------------------------------------------------------------
  27. Status Codes of getEntitlement:
  28. -------------------------------------------------------------------------------
  29.    Share [%]    Total Value
  30.    
  31. -------------------------------------------------------------------------------
  32. Status Codes of getPhoneNumber:
  33. -------------------------------------------------------------------------------
  34.    Share [%]    Total Value
  35.    
  36. -------------------------------------------------------------------------------
  37. Status Codes of getPhoneServicesAccountStatus:
  38. -------------------------------------------------------------------------------
  39.    Share [%]    Total Value
  40.    
  41. -------------------------------------------------------------------------------
  42. Status Codes of getProvisioning:
  43. -------------------------------------------------------------------------------
  44.    Share [%]    Total Value
  45.    
  46. -------------------------------------------------------------------------------
  47. Status Codes of setProvisioning:
  48. -------------------------------------------------------------------------------
  49.    Share [%]    Total Value
  50.    
  51. -------------------------------------------------------------------------------
  52. Status Codes of disablePushNotification:
  53. -------------------------------------------------------------------------------
  54.    Share [%]    Total Value
  55.    
  56. -------------------------------------------------------------------------------
  57. Status Codes of enablePushNotification:
  58. -------------------------------------------------------------------------------
  59.    Share [%]    Total Value
  60.    
  61. -------------------------------------------------------------------------------
  62. Status Codes of updatePushToken:
  63. -------------------------------------------------------------------------------
  64.    Share [%]    Total Value
  65.    
  66. -------------------------------------------------------------------------------
  67. Status Codes of getSubscriptionAndUsageStatus:
  68. -------------------------------------------------------------------------------
  69.    Share [%]    Total Value
  70.    
  71. -------------------------------------------------------------------------------
  72. Status Codes of setEntitlement:
  73. -------------------------------------------------------------------------------
  74.    Share [%]    Total Value
  75.    
  76. -------------------------------------------------------------------------------
  77. Status Codes of getPreferredRoamingNetworks:
  78. -------------------------------------------------------------------------------
  79.    Share [%]    Total Value
  80.    
  81. -------------------------------------------------------------------------------
  82. Status Codes of getSIMStatus:
  83. -------------------------------------------------------------------------------
  84.    Share [%]    Total Value
  85.    
  86. -------------------------------------------------------------------------------
  87. Status Codes of signUpForSIMService:
  88. -------------------------------------------------------------------------------
  89.    Share [%]    Total Value
  90.    
  91. -------------------------------------------------------------------------------
  92. Status Codes of serviceEntitlementStatus:
  93. -------------------------------------------------------------------------------
  94.    Share [%]    Total Value
  95.    
  96. -------------------------------------------------------------------------------
  97. Status Codes of manageSteering:
  98. -------------------------------------------------------------------------------
  99.    Share [%]    Total Value
  100.    
  101. -------------------------------------------------------------------------------
  102. Status Codes of authorizeDevice:
  103. -------------------------------------------------------------------------------
  104.    Share [%]    Total Value
  105.    
  106. -------------------------------------------------------------------------------
  107. Status Codes of manageConnectivity:
  108. -------------------------------------------------------------------------------
  109.    Share [%]    Total Value
  110.    
  111. -------------------------------------------------------------------------------
  112. Status Codes of manageService:
  113. -------------------------------------------------------------------------------
  114.    Share [%]    Total Value
  115.    
  116. -------------------------------------------------------------------------------
  117. Status Codes of registeredMsisdn:
  118. -------------------------------------------------------------------------------
  119.    Share [%]    Total Value
  120.    
  121. -------------------------------------------------------------------------------
  122. Status Codes of manageLocationAndTc:
  123. -------------------------------------------------------------------------------
  124.    Share [%]    Total Value
  125.    
  126. -------------------------------------------------------------------------------
  127. Status Codes of getMsisdn:
  128. -------------------------------------------------------------------------------
  129.    Share [%]    Total Value
  130.    
  131. -------------------------------------------------------------------------------
  132. Status Codes of _3gppAuthChallenge:
  133. -------------------------------------------------------------------------------
  134.    Share [%]    Total Value
  135.    
  136. -------------------------------------------------------------------------------
  137. Status Codes of _3gppAuthentication:
  138. -------------------------------------------------------------------------------
  139.    Share [%]    Total Value
  140.    
  141. -------------------------------------------------------------------------------
  142. Status Codes of managePushToken:
  143. -------------------------------------------------------------------------------
  144.    Share [%]    Total Value
  145.    
  146. -------------------------------------------------------------------------------
  147. Status Codes of registeredDevices:
  148. -------------------------------------------------------------------------------
  149.    Share [%]    Total Value
  150.    
  151. -------------------------------------------------------------------------------
  152. Error Codes of pushTokenMgmt:
  153. -------------------------------------------------------------------------------
  154.    Share [%]    Total Value
  155.    
  156. -------------------------------------------------------------------------------
  157. Error Codes of sppPushMessage:
  158. -------------------------------------------------------------------------------
  159.    Share [%]    Total Value
  160.       100.00        2 VALIDATION_FAILURE
  161.    
  162. -------------------------------------------------------------------------------
  163. Gcm Return Codes of sppPushMessage:
  164. -------------------------------------------------------------------------------
  165.    Share [%]    Total Value
  166.    
  167. -------------------------------------------------------------------------------
  168. Status Codes of APNSNotification:
  169. -------------------------------------------------------------------------------
  170.    Share [%]    Total Value
  171.        90.48       19 0
  172.         9.52        2 21
  173.    
  174. -------------------------------------------------------------------------------
  175. Status Codes of EmailOutgoing:
  176. -------------------------------------------------------------------------------
  177.    Share [%]    Total Value
  178.    
  179. -------------------------------------------------------------------------------
  180. Status Codes of GcmRedelivery:
  181. -------------------------------------------------------------------------------
  182.    Share [%]    Total Value
  183.    
  184. -------------------------------------------------------------------------------
  185. Records of XforwardedFor:
  186. -------------------------------------------------------------------------------
  187.    Share [%]    Total Value
  188.       100.00        4 10.175.147.226
  189.    
  190. -------------------------------------------------------------------------------
  191. Redelivery Times of GCM Message:
  192. -------------------------------------------------------------------------------
  193.    Share [%]    Total Value
  194.    
  195. -------------------------------------------------------------------------------
  196. Redelivery Times of APNS Message:
  197. -------------------------------------------------------------------------------
  198.    Share [%]    Total Value
  199.       100.00       21 0
  200.    
  201. -------------------------------------------------------------------------------
  202. Redelivery Times of Email Message:
  203. -------------------------------------------------------------------------------
  204.    Share [%]    Total Value
  205.    
  206. -------------------------------------------------------------------------------
  207. Status Code of APNS Response:
  208. -------------------------------------------------------------------------------
  209.    Share [%]    Total Value
  210.    
  211. -------------------------------------------------------------------------------
  212. Error Code of updateApnsTokenStatus:
  213. -------------------------------------------------------------------------------
  214.    Share [%]    Total Value
  215.    
  216. -------------------------------------------------------------------------------
  217. Error Code of queryApnsToken:
  218. -------------------------------------------------------------------------------
  219.    Share [%]    Total Value
  220.    
  221. -------------------------------------------------------------------------------
  222. ServiceName of QueryApnsToken:
  223. -------------------------------------------------------------------------------
  224.    Share [%]    Total Value
  225.    
  226. -------------------------------------------------------------------------------
  227. ServiceName of PushAppMessage:
  228. -------------------------------------------------------------------------------
  229.    Share [%]    Total Value
  230.        33.33       10 vvm
  231.        20.00        6 vowifi
  232.        10.00        3 gen,icloudvowifi,vowifi
  233.         6.67        2 chan1,chan2
  234.         6.67        2 icloudvowifi
  235.         6.67        2 gen
  236.         6.67        2 mca
  237.         3.33        1 testingchannel,vowifi
  238.         3.33        1 conn_mgr,vvm
  239.         3.33        1 multi-sim
  240.    
  241. -------------------------------------------------------------------------------
  242. ServiceName of SppPushMessage:
  243. -------------------------------------------------------------------------------
  244.    Share [%]    Total Value
  245.        50.00        2 undefined
  246.        50.00        2 vvm
  247.    
  248. -------------------------------------------------------------------------------
  249. ServiceName of APNSNotification:
  250. -------------------------------------------------------------------------------
  251.    Share [%]    Total Value
  252.        38.10        8 vowifi
  253.        23.81        5 icloudvowifi
  254.        14.29        3 gen
  255.         4.76        1 chan2
  256.         4.76        1 chan1
  257.         4.76        1 vvm
  258.         4.76        1 conn_mgr
  259.         4.76        1 multi-sim
  260.    
  261. -------------------------------------------------------------------------------
  262. ServiceName of PushTokenMgmt:
  263. -------------------------------------------------------------------------------
  264.    Share [%]    Total Value
  265.        29.09       16 vowifi
  266.        18.18       10 gen
  267.        14.55        8 icloudvowifi
  268.        12.73        7 vvm
  269.        10.91        6 mca
  270.         3.64        2 chan2
  271.         3.64        2 chan1
  272.         3.64        2 multi-sim
  273.         3.64        2 conn_mgr
  274.    
  275. -------------------------------------------------------------------------------
  276. Status code of samAuthorize:
  277. -------------------------------------------------------------------------------
  278.    Share [%]    Total Value
  279.    
  280. -------------------------------------------------------------------------------
  281. Status code of samExchangeToken:
  282. -------------------------------------------------------------------------------
  283.    Share [%]    Total Value
  284.    
  285. -------------------------------------------------------------------------------
  286. Status code of samRefreshToken:
  287. -------------------------------------------------------------------------------
  288.    Share [%]    Total Value
  289.    
  290. -------------------------------------------------------------------------------
  291. Status code of samValidateToken:
  292. -------------------------------------------------------------------------------
  293.    Share [%]    Total Value
  294.    
  295. -------------------------------------------------------------------------------
  296. Status code of samRevokeToken:
  297. -------------------------------------------------------------------------------
  298.    Share [%]    Total Value
  299.    
  300. -------------------------------------------------------------------------------
  301. Error Codes of samAuthorize:
  302. -------------------------------------------------------------------------------
  303.    Share [%]    Total Value
  304.    
  305. -------------------------------------------------------------------------------
  306. Error Codes of samExchangeToken:
  307. -------------------------------------------------------------------------------
  308.    Share [%]    Total Value
  309.    
  310. -------------------------------------------------------------------------------
  311. Error Codes of samRefreshToken:
  312. -------------------------------------------------------------------------------
  313.    Share [%]    Total Value
  314.    
  315. -------------------------------------------------------------------------------
  316. Error Codes of samValidateToken:
  317. -------------------------------------------------------------------------------
  318.    Share [%]    Total Value
  319.    
  320. -------------------------------------------------------------------------------
  321. Error Codes of samRevokeToken:
  322. -------------------------------------------------------------------------------
  323.    Share [%]    Total Value
  324.    
  325. -------------------------------------------------------------------------------
  326. Status code of ValidateSipUsernameAndDigest:
  327. -------------------------------------------------------------------------------
  328.    Share [%]    Total Value
  329.    
  330. -------------------------------------------------------------------------------
  331. Error code of ValidateSipUsernameAndDigest:
  332. -------------------------------------------------------------------------------
  333.    Share [%]    Total Value
复制代码
需要得到的提取的log代码:  Share [%]    Total   Value下有记录的全部抓取出来。。
如下所示:
  1. Start and End Time:
  2. -------------------------------------------------------------------------------
  3.    Start Time:  2016-08-08 18:43:11.126569426
  4.    End Time:    2016-08-09 04:50:10.248093935
  5.      
  6. -------------------------------------------------------------------------------
  7. SES Actions:
  8. -------------------------------------------------------------------------------
  9.    Share [%]    Total Value
  10.        44.96       58 pushTokenMgmt
  11.        34.11       44 pushAppMessage
  12.        16.28       21 APNSNotification
  13.         3.10        4 sppPushMessage
  14.         1.55        2 identitiesMapMessage


  15. -------------------------------------------------------------------------------
  16. Error Codes of sppPushMessage:
  17. -------------------------------------------------------------------------------
  18.    Share [%]    Total Value
  19.       100.00        2 VALIDATION_FAILURE


  20. -------------------------------------------------------------------------------
  21. Status Codes of APNSNotification:
  22. -------------------------------------------------------------------------------
  23.    Share [%]    Total Value
  24.        90.48       19 0
  25.         9.52        2 21


  26. -------------------------------------------------------------------------------
  27. Records of XforwardedFor:
  28. -------------------------------------------------------------------------------
  29.    Share [%]    Total Value
  30.       100.00        4 10.175.147.226


  31. -------------------------------------------------------------------------------
  32. Redelivery Times of APNS Message:
  33. -------------------------------------------------------------------------------
  34.    Share [%]    Total Value
  35.       100.00       21 0


  36. -------------------------------------------------------------------------------
  37. ServiceName of PushAppMessage:
  38. -------------------------------------------------------------------------------
  39.    Share [%]    Total Value
  40.        33.33       10 vvm
  41.        20.00        6 vowifi
  42.        10.00        3 gen,icloudvowifi,vowifi
  43.         6.67        2 chan1,chan2
  44.         6.67        2 icloudvowifi
  45.         6.67        2 gen
  46.         6.67        2 mca
  47.         3.33        1 testingchannel,vowifi
  48.         3.33        1 conn_mgr,vvm
  49.         3.33        1 multi-sim
  50.    
  51. -------------------------------------------------------------------------------
  52. ServiceName of SppPushMessage:
  53. -------------------------------------------------------------------------------
  54.    Share [%]    Total Value
  55.        50.00        2 undefined
  56.        50.00        2 vvm
  57.    
  58. -------------------------------------------------------------------------------
  59. ServiceName of APNSNotification:
  60. -------------------------------------------------------------------------------
  61.    Share [%]    Total Value
  62.        38.10        8 vowifi
  63.        23.81        5 icloudvowifi
  64.        14.29        3 gen
  65.         4.76        1 chan2
  66.         4.76        1 chan1
  67.         4.76        1 vvm
  68.         4.76        1 conn_mgr
  69.         4.76        1 multi-sim
  70.    
  71. -------------------------------------------------------------------------------
  72. ServiceName of PushTokenMgmt:
  73. -------------------------------------------------------------------------------
  74.    Share [%]    Total Value
  75.        29.09       16 vowifi
  76.        18.18       10 gen
  77.        14.55        8 icloudvowifi
  78.        12.73        7 vvm
  79.        10.91        6 mca
  80.         3.64        2 chan2
  81.         3.64        2 chan1
  82.         3.64        2 multi-sim
  83.         3.64        2 conn_mgr
复制代码

论坛徽章:
28
15-16赛季CBA联赛之八一
日期:2016-02-22 19:10:4215-16赛季CBA联赛之深圳
日期:2016-12-01 10:34:0415-16赛季CBA联赛之新疆
日期:2016-12-07 10:24:2915-16赛季CBA联赛之同曦
日期:2016-12-15 12:06:43CU十四周年纪念徽章
日期:2016-12-18 13:03:4415-16赛季CBA联赛之吉林
日期:2017-01-03 15:52:2515-16赛季CBA联赛之辽宁
日期:2017-01-04 14:58:2415-16赛季CBA联赛之辽宁
日期:2017-01-15 09:42:512016科比退役纪念章
日期:2017-02-06 17:21:50黑曼巴
日期:2017-02-10 15:46:1215-16赛季CBA联赛之上海
日期:2017-03-18 10:14:5415-16赛季CBA联赛之青岛
日期:2017-03-18 22:00:44
19 [报告]
发表于 2016-08-09 13:10 |只看该作者
回复 16# kkshaq


    问题在于: 你最后提供的数据看似空行的行里含有 空格 !
sed -r '/Start and/,/End Time/{/^\s+End Time/G;b};/-/{:a;$!N;/\n\s*$/!{$!ba};s/\n/&/5;t};d' file
sed -r '/Start and/,/End Time/{/^\s+End Time/G;b};/-/{:a;$!N;/\n\s*$/!{$!ba};/Total Value.*\n\s+\S+/b};d' file

论坛徽章:
1
2015亚冠之浦和红钻
日期:2015-05-26 14:37:09
20 [报告]
发表于 2016-08-09 13:14 |只看该作者
回复 19# moperyblue

果然如此,谢谢你啊。帮了我大忙。sed和awk真的很有用,不然这次就真抓瞎了。 ,谢了。大神!!

   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP