Все еще иначе, так как Вы знаете о выполнении некоторой разновидности ext?
, должен посмотреть на список функций файловой системы:
# tune2fs -l /dev/sda1 | grep features
Если в списке Вы видите:
extent
— это - ext4extent
, но has_journal
— это - ext3extent
ни has_journal
— это - ext2 parted
и blkid
ответы лучше, если Вы хотите эту эвристику, выполненную для Вас автоматически. (Они говорят различие с проверками функции, также.) Они могут также определить не -ext?
файловые системы.
Этот метод имеет достоинство показа Вам различия низкого уровня.
Важная вещь понять вот состоит в том, что эти три файловых системы являются совместимыми форвардами, и в некоторой степени назад совместимыми, также. Более поздние версии просто добавляют опции сверху более старых.
См. ext4 ПРАКТИЧЕСКОЕ РУКОВОДСТВО для получения дополнительной информации об этом.
Команду я думаю, что Вы ищете, называют fmt
.
$ fmt loremipsum.txt
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam vel
lectus ac enim venenatis porttitor in et est. Curabitur ut eros quis risus
consequat dictum a a lectus. Integer ut risus quis augue lobortis molestie
vel id nibh. Aliquam sit amet mattis lorem, vel ornare felis. Donec
pulvinar tempus lorem, at porta sem pretium ut. Cras ut lorem tincidunt,
scelerisque nunc vitae, posuere augue. Vestibulum iaculis libero id congue
ultrices. Nullam mauris ipsum, aliquet eget nisl non, venenatis euismod
enim. Phasellus a eleifend velit. Aenean molestie venenatis turpis,
consectetur convallis velit fringilla non.
Можно управлять результатами, такими как ширина, и т.д.
$ fmt --help
Usage: fmt [-WIDTH] [OPTION]... [FILE]...
Reformat each paragraph in the FILE(s), writing to standard output.
The option -WIDTH is an abbreviated form of --width=DIGITS.
Mandatory arguments to long options are mandatory for short options too.
-c, --crown-margin preserve indentation of first two lines
-p, --prefix=STRING reformat only lines beginning with STRING,
reattaching the prefix to reformatted lines
-s, --split-only split long lines, but do not refill
-t, --tagged-paragraph indentation of first line different from second
-u, --uniform-spacing one space between words, two after sentences
-w, --width=WIDTH maximum line width (default of 75 columns)
--help display this help and exit
--version output version information and exit
With no FILE, or when FILE is -, read standard input.
Вероятно, лучшим выбором был бы текстовый редактор; большинство из них предлагает перенос текста некоторого вида.
При поиске чего-то более простого Вы могли бы придумать что-то использование sed
или подобный. Помещение длинной линии в a loremipsum.txt
, и разрешение sed
перенеситесь после 56-73 символов, сопровождаемых пространством, это дает Ваш желаемый результат...
$ sed -r -e 's/.{56,73} /&\n/g' loremipsum.txt
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam vel
lectus ac enim venenatis porttitor in et est. Curabitur ut eros quis
risus consequat dictum a a lectus. Integer ut risus quis augue lobortis
molestie vel id nibh. Aliquam sit amet mattis lorem, vel ornare felis.
Donec pulvinar tempus lorem, at porta sem pretium ut. Cras ut lorem
tincidunt, scelerisque nunc vitae, posuere augue. Vestibulum iaculis
libero id congue ultrices. Nullam mauris ipsum, aliquet eget nisl non,
venenatis euismod enim. Phasellus a eleifend velit. Aenean molestie
venenatis turpis, consectetur convallis velit fringilla non.
... или Вы могли просто использовать fold -s -w 74 loremipsum.txt
Я предполагаю...
Можно передать текст по каналу в fold -s -w 72
получить тот результат.
Если Ваша система не имеет fold
но установили Python, можно сделать:
cat /var/tmp/li.txt | cat /var/tmp/li.txt | python -c "import sys; from textwrap import fill; print fill(sys.stdin.read(), width=72)"