我遇到了同样的问题 - 通过电子邮件发送包含80字符的段落正文中的强制换行符的纯文本文件...这些文件在(a)自行换行和(b)换行的设备上看起来很糟糕宽度小于80 ...也就是说,80-字符分割清晰可见,文本在行的中间结束。
如何打开这些线?
根据RaúlSalinas-Monteagudo的建议,使用unix命令行工具'fmt'。将行长度(-w ##)更改为有用的数字。您可以尝试65或55,或尝试1111或更大。
例:
来自气象办公室的这个文件(https://forecast.weather.gov/product.php?site=NWS&issuedby=AT&product=TWO&format=txt&version=1&glossary=0)包含嵌入在段落正文中的硬线。我只想在段落末尾添加换行符。将输出管道输出为'fmt -w 1111'(对于长度小于1111个字符的段落)可以解决问题:
/usr/local/bin/w3m -dump 'https://forecast.weather.gov/product.php?site=NWS&issuedby=AT&product=TWO&format=txt&version=1&glossary=0' | sed -n '/TWOAT/,/Forecaster/p' | fmt -w 1111
。
改变外观:
The National Hurricane Center is issuing advisories on
Tropical Storm Beryl, located a couple of hundred miles
east of the Lesser Antilles, and on Tropical Storm
Chris, located more than one hundred miles south of the
North Carolina Outer Banks.
Tropical cyclone formation is not expected during the
next 5 days.
对此:
The National Hurricane Center is issuing advisories on Tropical Storm Beryl, located a couple of hundred miles east of the Lesser Antilles, and on Tropical Storm Chris, located more than one hundred miles south of the North Carolina Outer Banks.
Tropical cyclone formation is not expected during the next 5 days.