合并并重新格式化文本

合并并重新格式化文本

我有很多圣经文本看起来像

创 1:1 起初,神创造
天地。
创 1:2 地是空虚
混沌,黑暗不定,
神的灵运行在
地上。
创 1:3 神说:“要有
光”,就有了光。
创 1:4 神看着是好的,
就把光暗分开了

我希望每节诗句都在自己的行上,没有 ^p 标记,并删除书章诗句,看起来像这样 - 我有 Word 2007-Notepad++ 和 PsPad 来实现这一点 - 最好的方法是什么看起来像这样

起初,上帝创造了天地。
地是空虚的,一片无形的物质,笼罩在黑暗之中。上帝
说:“要有光”,于是就有了光。
上帝看着是好的。于是,他把光与暗分开。
上帝称光为“昼”,称暗为“夜”。两者合在一起构成了——

答案1

您将需要使用正则表达式来搜索模式,然后替换/重新格式化文本。

常用表达:http://regular-expressions.mobi/index.html

答案2

你可以用 notepad++ 做一些技巧
开始之前,您可能需要备份文件

您可以格式化换行符,例如,如果您选择所有文本并按Ctrl + j,这将使您的文本变成一行。

示例
输入:

 Gen 1:1 In the beginning God created
 the heavens and the earth.
 Gen 1:2 The earth was empty, a
 formless mass cloaked in darkness. And
 the Spirit of God was hovering over
 its surface.

输出:

Gen 1:1 In the beginning God created  the heavens and the earth.  Gen 1:2 The earth was empty, a  formless mass cloaked in darkness. And  the Spirit of God was hovering over  its surface.

然后,您可以通过打开“搜索”>“替换...”(热键 -Ctrl + H),将搜索模式设置为“扩展”,在“查找内容:”中输入:““,在‘替换为:’处写入”.\n",然后按全部替换

示例
输入:

Gen 1:1 In the beginning God created  the heavens and the earth.  Gen 1:2 The earth was empty, a  formless mass cloaked in darkness. And  the Spirit of God was hovering over  its surface.

输出:

 Gen 1:1 In the beginning God created  the heavens and the earth.
 Gen 1:2 The earth was empty, a  formless mass cloaked in darkness.
 And  the Spirit of God was hovering over  its surface.

要删除“Gen”部分,您需要做的就是将搜索模式更改为正则表达式,在“查找内容:”中输入“Gen (...)”,“替换为:”保持为空。按“全部替换”并:

输入:

 Gen 1:1 In the beginning God created  the heavens and the earth.
 Gen 1:2 The earth was empty, a  formless mass cloaked in darkness.
 And  the Spirit of God was hovering over  its surface.

输出:

 In the beginning God created  the heavens and the earth.
 The earth was empty, a  formless mass cloaked in darkness.
 And  the Spirit of God was hovering over  its surface.

答案3

我热爱这个东西。我一直将书籍扫描并 OCR 成 MOBI。

你想要的很简单:在你最喜欢的 RegEx 工具中(我的是 EditPlus,因为我可以立即对 200 个文件执行此操作)使用以下命令开始(忽略初始空间):

Replace: ([a-z])\n([a-z])
With: \1 \2

下一个:

Replace: ^([A-Z])([a-z]+) ([0-9]+):([0-9]+)
With: 

That is, blank.

你明白了。

相关内容