如何删除不需要的换行符而不影响其余格式?

如何删除不需要的换行符而不影响其余格式?

示例文本:

I give Pirrip as my father's family name, 
on the authority of his
tombstone and my sister,--Mrs. Joe Gargery, who married the blacksmith.
As I never saw my father or my mother, 
and never saw any likeness
of either of them (for their days were long before the days of
photographs), my first fancies regarding what they were like were
unreasonably derived from their tombstones.

大多数网站都提供了如何删除换行符的解决方案,但这会删除所有格式。我想要的是保持墓碑后面的 ^p 符号,当然还有点,但是去除这些 ^p 破坏了第 2、4 和 5 行,位于 his、mother 和 likeness 后面,对此我找不到解决方案。有人能帮我吗?

答案1

在 Word 中尝试此序列。不要输入双引号。用空格替换连字符(我不得不使用连字符,这样你才能看到有多少个空格)

replace all "^p^p" with "~~~" (to preserve wanted paragraph line breaks)
replace all "^p" with "-" (replace the unwanted line breaks with a space)
replace all "--" with "-" (fix any double spaces introduced by the command above)
replace all "~~~" with "^p^p" (restore the paragraph line breaks)

如果您可以提供原始示例的链接,将会更有帮助,因为在您复制并粘贴到 superuser.com 后,我们无法分辨空格/段落符号

相关内容