我在不同的文件中有 2 个文本,file1
并且file2
.我需要一个接受file1
和file2
作为参数并在终端上打印的命令
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.
答案1
对于大小为 10 且距离为 20 个字符的列
paste <(fold file1 -w 10) <(fold file2 -sw 10) | pr -t -e20
fold
选项-w
是列宽-s
避免逐行分隔单词
pr
选项-t
导致省略页眉和页脚(日期、时间和页码)-eN
设置N
为替换制表符的空格数paste