Print two files in two columns side-by-side
7
votes
4
answers
13814
views
I want to output two text files in two columns — one on the left side and other one on the right.
paste
doesn't solve the problem, because it only insert a character as delimiter, so if the first file has lines of different lengths output will be twisted:
$ cat file1
looooooooong line
line
$ cat file2
hello
world
$ paste file1 file2
looooooooong line hello
line world
If there was a command to add trailing spaces like fmt --add-spaces --width 50
the problem would be solved(1):
$ paste (1) **UPD:** command to add trailing spaces does exist, e. g. -d '\n' printf '%-50s\n'
.
But running
`$ paste
Asked by belkka
(483 rep)
Sep 16, 2017, 06:06 PM
Last activity: Sep 22, 2022, 03:25 PM
Last activity: Sep 22, 2022, 03:25 PM