Search notes:

Shell command: pr

pr paginates or columnates text files (originally for printing).

Print the content of two text files side by side

If the content of ~/file-1.txt is
one
two
three
four
five
… and the content of ~/file-2.txt is
foo
bar
baz
… then the following command will print their content «side by side»:
$ pr -mt ~/file-1.txt ~/file-2.txt
one                                 foo
two                                 bar
three                               baz
four
five
This behavior is somewhat similar to the result obtained with paste or with positional joins in DuckDB.

Print the output of two programs side by side

Process substitution can be used to print the output of two programs side by side.
The following example prints file in /tmp starting with a on the left side, files starting with w on the right side:
$ pr -mt -w 100 <( ls -1 /tmp/a* ) <( ls -1 /tmp/w* )

See also

Shell commands

Index