在 Ubuntu 上,如何重新格式化文本以适合宽度(最后一行除外),并在必要时添加空格?我能得到的最接近的是 with fmt --width=64
,但这不会在单词之间添加空格。
输入
- 摘自的片段
man zip
,删除了所有换行符并将双空格变成了单空格
Do not operate on files modified prior to the specified date, where mm is the month (00-12), dd is the day of the month (01-31), and yyyy is the year. The ISO 8601 date format yyyy-mm-dd is also accepted. For example:
fold --width=64
输出
- 断言,这是不可取的
Do not operate on files modified prior to the specified date, wh
ere mm is the month (00-12), dd is the day of the month (01-31),
and yyyy is the year. The ISO 8601 date format yyyy-mm-dd is al
so accepted. For example:
fmt --width=65
输出
- 几乎完美,但还需要在单词之间添加空格
Do not operate on files modified prior to the specified date,
where mm is the month (00-12), dd is the day of the month
(01-31), and yyyy is the year. The ISO 8601 date format
yyyy-mm-dd is also accepted. For example:
想要的输出
- 片段取自
man zip
- 在哪里插入双/三空格对我来说并不重要,只要线条符合指定的宽度并且单词或多或少均匀分布即可
Do not operate on files modified prior to the specified date,
where mm is the month (00-12), dd is the day of the month
(01-31), and yyyy is the year. The ISO 8601 date format
yyyy-mm-dd is also accepted. For example: