![如何删除不需要的换行符而不影响其余格式?](https://linux22.com/image/1349444/%E5%A6%82%E4%BD%95%E5%88%A0%E9%99%A4%E4%B8%8D%E9%9C%80%E8%A6%81%E7%9A%84%E6%8D%A2%E8%A1%8C%E7%AC%A6%E8%80%8C%E4%B8%8D%E5%BD%B1%E5%93%8D%E5%85%B6%E4%BD%99%E6%A0%BC%E5%BC%8F%EF%BC%9F.png)
示例文本:
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 后,我们无法分辨空格/段落符号