如果我运行cat file1.txt
,则有:
linux mint
ubuntu
cent-os
fedora
debian
kali linux
arch linux
kubuntu
open suse
deepin
parrot os
然后cat file2.txt
给出:
linux mint
cent-os
fedora
kali linux
arch linux
kubuntu
open
deepin
parrot
ubuntu
debian
但如果我想做出这样的输出该怎么办?
file1.txt file2.txt
linux mint linux mint
ubuntu cent-os
cent-os fedora
fedora kali linux
debian arch linux
kali linux kubuntu
arch linux open
kubuntu deepin
open suse parrot
deepin ubuntu
parrot os debian
答案1
答案2
pr
像这样使用时会做你想做的事:
pr -mt file1.txt file2.txt
-m
将并行打印所有文件。-t
将省略页眉和页尾。
示例输出:
linux mint linux mint
ubuntu cent-os
cent-os fedora
fedora kali linux
debian arch linux
kali linux kubuntu
arch linux open
kubuntu deepin
open suse parrot
deepin ubuntu
parrot os debian