我需要将每5行合并为1.我有一个wordlist字典,其中包含1000行示例:
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
答案 0 :(得分:0)
^(.+)\R(.+)\R(.+)\R(.+)\R
$1 $2 $3 $4
. matches newline
<强>解释强>
^ : 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