首页 > 解决方案 > Linux/nix:使用 pr 格式化文本 - 如何添加换行符?

问题描述

pr(1)用来玩格式化文本文件。我的问题是包含长行的文本文件不会自动换行并继续。在下一行。考虑例如尝试准备pr要打印在 A4 页面上的文本。我已经检查了手册页,但我很困惑。一定有办法吗?

一个说明性的例子:

$ pr -n letter 


2021-02-23 08:39                      letter                      Page 1


    1   Hi,
    2   
    3   This is a letter with very a long line. It's made to prove my point. This would not fit e.g. an A4-paper. How do I make ``pr`` automatically insert new lines/prepare the text so that it will be possible to read?
    4   
    5   All the best,
    6   pr

我要寻找的是这样的输出:

$ pr -n letter 


2021-02-23 08:39                      letter                      Page 1


    1   Hi,
    2   
    3   This is a letter with very a long line. It's made to prove my
    4   point. This would not fit e.g. an A4-paper. How do I make ``pr``
    5   automatically insert new lines/prepare the text so that it will
    6   be possible to read?
    7   
    8   All the best,
    9   pr

pr欣赏大师们的所有提示和技巧。

标签: linuxgnu

解决方案


推荐阅读