合并具有给定条件的行
Merging lines with a given condition
我有一个文件,其中包含不同顺序的内容。我想将两个空行之间的行合并为一行。示例:
This
was
not
good
Can
it
be
done
like
this
至
This was not good
Can it be done like this
通过搜索
\r?\n(?!\r?\n)
并替换为 " "
。
似乎 Gedit 不支持 ?
后视运算符。这对我有用:
(?<!\n)\r?\n(?!\r?\n)
我有一个文件,其中包含不同顺序的内容。我想将两个空行之间的行合并为一行。示例:
This
was
not goodCan
it
be
done like
this
至
This was not good
Can it be done like this
通过搜索
\r?\n(?!\r?\n)
并替换为 " "
。
似乎 Gedit 不支持 ?
后视运算符。这对我有用:
(?<!\n)\r?\n(?!\r?\n)