I want to print two files in two columns -- first file on the left side and second on the right side.
paste doesn't do the job, since it can only insert a character as delimiter. If first file has lines with different lengthes output will be twisted:
$ cat file1 looooooooong line line $ cat file2 hello world $ paste file1 file2 looooooooong line hello line world
If it was a command for adding trailing spaces like
fmt --add-spaces --width 50 the problem would be solved:
$ paste <(fmt --add-spaces --width 50 file1) file2 looooooooong line hello line world
But I don't know a simple way to do this.
So how to merge and print several files horizontally without twisting? Actually, I just want to look at them simultaneously.
UPD: hypothetical commands for adding trailing spaces exist (for example
xargs -d '\n' printf '%-50s\n')
But it is worth to notice that solution
$ paste <(adding-spaces-command file1) file2
will not work as expected when file1 contain lesser amount of lines than file2 does.