首页 > 解决方案 > 每5行合并一次

问题描述

我需要将每 5 行合并为 1。我有一个包含 1000 行示例的 wordlist 字典:

line 1
line 2
.
line 1000

我需要每 5 行组合一次:

line 1 line 2 line 3 line 4 line 5
.
line 996 line 997 line 998 line 999 line 1000

标签: notepad++editing

解决方案


  • Ctrl+H
  • 找什么:^(.+)\R(.+)\R(.+)\R(.+)\R
  • 用。。。来代替:$1 $2 $3 $4
  • 检查环绕
  • 检查正则表达式
  • 不要检查. matches newline
  • Replace all

解释:

^       : beginning of line
(.+)    : group 1, 1 or more any character 
\R      : any kind of line break
        : same pattern occurs 4 times.

替代品:

$1      : content of group 1
        : a space
        : same for other groups

推荐阅读