合并/连接Notepad++中基于分隔符的行。

huangapple go评论63阅读模式
英文:

Combine/Join lines in Notepad++ based on separator

问题

抱歉,以下是您要翻译的内容:

I have a text log file in the following format.

Is there a way in Notepad++ to combine lines between the " *" separators so the data looks like below

Thanks!

英文:

I have a text log file in the following format.

****************************************************************************************
line1
line2
line3
****************************************************************************************
line4
line5
line6
****************************************************************************************

Is there a way in Notepad++ to combine lines between the "*" separators so the data looks like below

****************************************************************************************
line1 line2 line3
****************************************************************************************
line4 line5 line6
****************************************************************************************

Thanks!

答案1

得分: 1

  • <kbd>Ctrl</kbd>+<kbd>H</kbd>: 按下Ctrl + H

  • Find what: (?&lt;!\*)\R(?!\*): 查找内容: (?&lt;!\*)\R(?!\*)

  • Replace with: # a space: 替换为: 空格 # 一个空格

  • SELECT Regular expression: 选择 正则表达式

  • <kbd>Replace all</kbd>: 按下Ctrl + H中的“替换全部”

英文:
  • <kbd>Ctrl</kbd>+<kbd>H</kbd>
  • Find what: (?&lt;!\*)\R(?!\*)
  • Replace with: # a space
  • SELECT Regular expression
  • <kbd>Replace all</kbd>

Explanation:

(?&lt;!\*)         # negative lookbehind, make sure we haven&#39;t a * before
\R              # any kind of linebreak
(?!\*)          # negative lookahead, make sure we haven&#39;t * after

Screenshot (before):

合并/连接Notepad++中基于分隔符的行。

Screenshot (after):

合并/连接Notepad++中基于分隔符的行。

huangapple
  • 本文由 发表于 2023年3月4日 03:31:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/75631187.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定