Я хотел бы просто взять данный текстовый файл и осуществить максимальную длину столбца, говорят 80. Как может я поворачивать это:
Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.
и превратите его в это:
Four score and seven years ago our fathers brought forth on this continent, a n
ew nation, conceived in Liberty, and dedicated to the proposition that all men
are created equal.
Используйте команду сгиба:
fold -s -w 80 filename
Опустите -s
опция, если Вы предпочитаете повреждаться на символьных границах, а не границах слова (на самом деле пробелы).
Я подозреваю, что это не будет работать очень хорошо, если текст будет закодирован в многобайтовом кодировании, таком как UTF-8 (и содержит символы неASCII).
При использовании Windows используйте Cygwin, UnxUtils или GnuWin32 - они, вероятно, включают сгиб.
$ fmt --width=80 <<< 'Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.'
Four score and seven years ago our fathers brought forth on this continent,
a new nation, conceived in Liberty, and dedicated to the proposition that
all men are created equal.