How to get the output of two cat commands parallel to each other
If I run cat file1.txt, I have:
linux mint
ubuntu
cent-os
fedora
debian
kali linux
arch linux
kubuntu
open suse
deepin
parrot osThen cat file2.txt gives:
linux mint
cent-os
fedora
kali linux
arch linux
kubuntu
open
deepin
parrot
ubuntu
debianBut what if I want to make output like this?
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 Answers
What you need is paste commad which paste rows in files side by side:
paste file1.txt file2.txtThis outputs exactly what you wanted.
For more options check man paste.
pr will do what you want when used like so:
pr -mt file1.txt file2.txt-mwill print all files in parallel.-twill omit page headers and trailers.
Example output:
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