免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1719 | 回复: 4
打印 上一主题 下一主题

请教文本处理问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-03-22 13:35 |只看该作者 |倒序浏览
11/03/11 02:47:59 - Process(434324.1) User(mqm) Program(amqzxma0_nd)
AMQ6162: An error has occurred reading an INI file.

EXPLANATION:
An error has occurred when reading the MQS.INI file or a queue manager QM.INI
file.
ACTION:
If you have been changing the INI file content check and correct the change.
----- amqxfdcx.c : 783 --------------------------------------------------------
11/03/11 02:47:59 - Process(434324.1) User(mqm) Program(amqzxma0_nd)
AMQ6184: An internal WebSphere MQ error has occurred on queue manager
QM_GW_OUT.

EXPLANATION:
An error has been detected, and the WebSphere MQ error recording routine has
been called. The failing process is process 434324.
ACTION:
Use the standard facilities supplied with your system to record the problem
identifier and to save any generated output files. Use either the WMQ Support
----- amqxfdcx.c : 822 --------------------------------------------------------

要处理的文本包括三个部分:
(1) 为时间和进程
(2) Explanation
(3) Action

分割符为---- amqxfdcx.c:

我想实现,把每一段中的(1)(2) 合并成为一行,(3) 删除,分割符也删除,最后的结果为:
11/03/11 02:47:59 - Process(434324.1) User(mqm) Program(amqzxma0_nd) AMQ6162: An error has occurred reading an INI file. Explanation:
11/03/11 02:47:59 - Process(434324.1) User(mqm) Program(amqzxma0_nd) AMQ6184: An internal WebSphere MQ error has occurred on queue manager QM_GW_OUT. Explanation:


使用SED能实现吗?求指教

论坛徽章:
2
射手座
日期:2014-10-10 15:59:4715-16赛季CBA联赛之上海
日期:2016-03-03 10:27:14
2 [报告]
发表于 2012-03-22 13:51 |只看该作者
回复 1# xiaoyang8791
  1. sed -n '/Process/{:a;/ACTION/{g;s/\n//gp;s/.*//;h;b};H;n;ba}'
复制代码

论坛徽章:
0
3 [报告]
发表于 2012-03-22 14:09 |只看该作者
  1. sed -n '/Process/{:a N;/\nACTION/!ba;s/\n/ /g;s/ACTION:$//;p}' data
复制代码

论坛徽章:
0
4 [报告]
发表于 2012-03-22 14:12 |只看该作者
我试了一下,可以实现,多谢!

论坛徽章:
0
5 [报告]
发表于 2012-03-22 14:22 |只看该作者
  1. sed ':a;N;/-----/!ba;s/ACTION:.*-//;s/\n//g;'
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP