入力する

入力する

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:

ベストアンサー1

タスクを実行するには、nroffを使用することをお勧めします。以下は、infileというファイルのテキストでそれを使用する方法の例です。

$ 2>/dev/null nroff <(echo .pl 1 ; echo .ll 40) infile
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:

.pl 1 roff タグはページの高さを 1 行に設定してページングを無効にします。

.ll 40は行の長さを40文字に設定します。

nroffは、優れたカスタマイズ可能性を備えた特別なマークアップフォーマットユーティリティです。

おすすめ記事