合并每 5 行
Combine every 5 lines
我需要将每 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
- Ctrl+H
- 查找内容:
^(.+)\R(.+)\R(.+)\R(.+)\R
- 替换为:
- 选中环绕
- 检查正则表达式
- 不勾选
. matches newline
- 全部替换
解释:
^ : beginning of line
(.+) : group 1, 1 or more any character
\R : any kind of line break
: same pattern occurs 4 times.
替换:
: content of group 1
: a space
: same for other groups
我需要将每 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
- Ctrl+H
- 查找内容:
^(.+)\R(.+)\R(.+)\R(.+)\R
- 替换为:
- 选中环绕
- 检查正则表达式
- 不勾选
. matches newline
- 全部替换
解释:
^ : beginning of line
(.+) : group 1, 1 or more any character
\R : any kind of line break
: same pattern occurs 4 times.
替换:
: content of group 1
: a space
: same for other groups