如何在两列中打印 2 个文本

use*_*456 1 text-processing columns text-formatting

我在不同的文件中有 2 个文本file1file2. 我需要一个将file1file2作为参数并在终端上打印的命令

This is text 1. This is              This is text 2. This is
text 1.This is text 1. This          text 2.This is text 2. This
is text 1. This is text 1.           is text 2. This is text 2. 
This is text 1.                      This is text 2.
Run Code Online (Sandbox Code Playgroud)

use*_*456 6

对于大小为 10 的 20 个字符的列

paste <(fold file1 -w 10) <(fold file2 -sw 10)  | pr -t -e20
Run Code Online (Sandbox Code Playgroud)
  • fold 选项

    • -w 是列宽
    • -s 避免将单词逐行分开
  • pr 选项

    • -t 导致省略页眉和页脚(日期、时间和页码)
    • -eN设置N为替换由产生的制表符的空格数paste