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, because it can only insert a character as delimiter, so if first file lines have different length 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 to add 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: command to add trailing spaces does exist (for example,
xargs -d '\n' printf '%-50s\n')
But solution like
$ paste <(add-trailing-spaces file1) file2
does not work as expected when file1 has fewer lines than file2.