免费注册 查看新帖 |

Chinaunix

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

将文件中部分内容都得的前后两行或者前后三行合为一行 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-10-11 15:28 |只看该作者 |倒序浏览
文件部分内容如下:
  1. .......
  2. <property name="connection.username">MAIN</property>
  3.                 <property name="connection.password">36zn+MsoQ</property>

  4.                 <!-- transaction api -->
  5.                 <property name="hibernate.transaction.factory_class">
  6.                         org.hibernate.transaction.JDBCTransactionFactory
  7.                 </property>

  8.                 <!-- Bind the getCurrentSession() method to the thread, session-per-conversation -->
  9.                 <property name="current_session_context_class">thread</property>
  10.                 <property name="transaction.auto_close_session">true</property>
  11. <!--mappings -->
  12. <!--<mapping resource="cn/bestwiz/jhf/core/dao/bean/main/JhfStopErrorMail.hbm.xml" />-->
  13. <mapping resource="cn/bestwiz/jhf/core/dao/bean/main/JhfDailyStatAll.hbm.xml" />
  14. <mapping
  15.                         resource="cn/bestwiz/jhf/core/dao/bean/main/JhfLeverageGroup.hbm.xml" />
  16.                 <mapping
  17.                         resource="cn/bestwiz/jhf/core/dao/bean/main/JhfSwapPoint.hbm.xml" />
  18. <!--
  19.                 <mapping
  20.                         resource="cn/bestwiz/jhf/core/dao/bean/main/JhfDepositStatusHistory.hbm.xml" />
  21. -->
  22. .......
  23. .......
  24. <class-cache
  25.                         class="cn.bestwiz.jhf.core.dao.bean.main.JhfCurrencyHolidayMaster"
  26.                         usage="read-write" />
  27.                 <class-cache class="cn.bestwiz.jhf.core.dao.bean.main.JhfSwapPoint" usage="read-write" />
  28. <!--
  29.                 <class-cache
  30.                         class="cn.bestwiz.jhf.core.dao.bean.main.JhfLeverageGroup"
  31.                         usage="read-write" />
  32. -->
复制代码
想要得到的结果:
  1. .......
  2. <property name="connection.username">MAIN</property>
  3.                 <property name="connection.password">36zn+MsoQ</property>

  4.                 <!-- transaction api -->
  5.                 <property name="hibernate.transaction.factory_class">
  6.                         org.hibernate.transaction.JDBCTransactionFactory
  7.                 </property>

  8.                 <!-- Bind the getCurrentSession() method to the thread, session-per-conversation -->
  9.                 <property name="current_session_context_class">thread</property>
  10.                 <property name="transaction.auto_close_session">true</property>
  11. <!--mappings -->
  12. <!--<mapping resource="cn/bestwiz/jhf/core/dao/bean/main/JhfStopErrorMail.hbm.xml" />-->
  13. <mapping resource="cn/bestwiz/jhf/core/dao/bean/main/JhfDailyStatAll.hbm.xml" />
  14. <mapping resource="cn/bestwiz/jhf/core/dao/bean/main/JhfLeverageGroup.hbm.xml" />
  15. <mapping resource="cn/bestwiz/jhf/core/dao/bean/main/JhfSwapPoint.hbm.xml" />
  16. <!--<mapping resource="cn/bestwiz/jhf/core/dao/bean/main/JhfDepositStatusHistory.hbm.xml" />-->
  17. .......
  18. .......
  19. <class-cache class="cn.bestwiz.jhf.core.dao.bean.main.JhfCurrencyHolidayMaster" usage="read-write" />
  20. <class-cache class="cn.bestwiz.jhf.core.dao.bean.main.JhfSwapPoint" usage="read-write" />
  21. <!-- <class-cache class="cn.bestwiz.jhf.core.dao.bean.main.JhfLeverageGroup" usage="read-write" />-->
复制代码

论坛徽章:
23
15-16赛季CBA联赛之吉林
日期:2017-12-21 16:39:27白羊座
日期:2014-10-27 11:14:37申猴
日期:2014-10-23 08:36:23金牛座
日期:2014-09-30 08:26:49午马
日期:2014-09-29 09:40:16射手座
日期:2014-11-25 08:56:112015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:49:0315-16赛季CBA联赛之山东
日期:2017-12-21 16:39:1915-16赛季CBA联赛之广东
日期:2016-01-19 13:33:372015亚冠之山东鲁能
日期:2015-10-13 09:39:062015亚冠之西悉尼流浪者
日期:2015-09-21 08:27:57
2 [报告]
发表于 2008-10-11 16:56 |只看该作者
sed '/<!--mappings/{:a;N;$!ba;s/\n//g;s/  */ /g;s/> *</>\n</g}' urfile

论坛徽章:
0
3 [报告]
发表于 2008-10-11 17:09 |只看该作者
<!-- <mapping resource="cn/bestwiz/jhf/core/dao/bean/main/JhfDepositStatusHistory.hbm.xml" />-->..............<class-cache class="cn.bestwiz.jhf.core.dao.bean.main.JhfCurrencyHolidayMaster" usage="read-write" />
如上
还有点小瑕疵

论坛徽章:
0
4 [报告]
发表于 2008-10-11 17:47 |只看该作者
原帖由 ly5066113 于 2008-10-11 16:56 发表
sed '/



格式还是不对呀
  1. <mapping resource="cn/bestwiz/jhf/core/dao/bean/main/JhfUserLoginLog.hbm.xml" />                <mapping                        resource="cn/bestwiz/jhf/core/dao/bean/main/JhfLeverageGroup.hbm.xml" />            <mapping                        resource="cn/bestwiz/jhf/core/dao/bean/main/JhfSwapPoint.hbm.xml" />
  2. <!--            <mapping                        resource="cn/bestwiz/jhf/core/dao/bean/main/JhfDepositStatusHistory.hbm.xml" />--><mapping                        resource="cn/bestwiz/jhf/core/dao/bean/main/JhfWithdrawal.hbm.xml" />           <mappingresource="cn/bestwiz/jhf/core/dao/bean/main/JhfAccountStatusMail.hbm.xml" />            <mapping                        resource="cn/bestwiz/jhf/core/dao/bean/main/JhfExecution.hbm.xml" />                <mapping                        resource="cn/bestwiz/jhf/core/dao/bean/main/JhfCurrencyHolidayMaster.hbm.xml" />            <mapping                        resource="cn/bestwiz/jhf/core/dao/bean/main/JhfDlPriceTemplate.hbm.xml" />          <mapping                        resource="cn/bestwiz/jhf/core/dao/bean/main/JhfReportConfigHistory.hbm.xml" />              <mapping                        resource="cn/bestwiz/jhf/core/dao/bean/main/JhfTradeConstraint.hbm.xml" />          <mapping                        resource="cn/bestwiz/jhf/core/dao/bean/main/JhfStatusContrl.hbm.xml" /><mapping                        resource="cn/bestwiz/jhf/core/dao/bean/main/JhfAliveOrder.hbm.xml" />           <mappingresource="cn/bestwiz/jhf/core/dao/bean/main/JhfDealerOrder.hbm.xml" />          <mapping                        resource="cn/bestwiz/jhf/core/dao/bean/main/JhfDeposit.hbm.xml" />          <mapping                        resource="cn/bestwiz/jhf/core/dao/bean/main/JhfRateMail.hbm.xml" />         <mapping                        resource="cn/bestwiz/jhf/core/dao/bean/main/JhfGroup.hbm.xml" /><mapping                        resource="cn/bestwiz/jhf/core/dao/bean/main/JhfMarginAccountHistory.hbm.xml" />         <mappingresource="cn/bestwiz/jhf/core/dao/bean/main/JhfDlProperty.hbm.xml" />           <mapping                        resource="cn/bestwiz/jhf/core/dao/bean/main/JhfCpTradeRequest.hbm.xml" />
  3. <!--            <mapping                        resource="cn/bestwiz/jhf/core/dao/bean/main/JhfContractStatusHistory.hbm.xml" />--><mapping                        resource="cn/bestwiz/jhf/core/dao/bean/main/JhfContractEodStat.hbm.xml" />
  4. <!--            <mapping                        resource="cn/bestwiz/jhf/core/dao/bean/main/JhfDailySwapHistory.hbm.xml" />-->
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP