Text-Processing

如何在兩列中列印 2 個文本

  • October 17, 2016

我在不同的文件中有 2 個文本file1file2. 我需要一個將file1andfile2作為參數並在終端上列印的命令

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.

對於大小為 10 的列,距離為 20 個字元

paste <(fold file1 -w 10) <(fold file2 -sw 10)  | pr -t -e20
  • fold選項

    • -w是列寬
    • -s避免逐行分隔單詞
  • pr選項

    • -t 導致省略頁眉和頁腳(日期、時間和頁碼)
    • -eN設置N為替換製表符的空格數paste

引用自:https://unix.stackexchange.com/questions/315876