No Ubuntu, como reformatar o texto para caber na largura (exceto a linha final), adicionando espaços quando necessário? O mais próximo que consigo chegar é com fmt --width=64
, mas isso não adiciona os espaços entre as palavras.
Entrada
- trecho retirado
man zip
com todas as quebras de linha removidas e espaços duplos transformados em espaços simples
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
saída
- quebra palavras, o que é indesejável
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
saída
- quase perfeito, mas também preciso adicionar espaços entre as palavras
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:
Saída desejada
- trecho retirado de
man zip
- onde os espaços duplos/triplos são inseridos não é importante para mim, desde que a linha caiba na largura especificada e as palavras estejam mais ou menos espaçadas uniformemente
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: