Print two files in two columns

With single pr command:

pr -Tm file[12]
  • -T (--omit-pagination) - omit page headers and trailers, eliminate any pagination by form feeds set in input files

  • -m (--merge) - print all files in parallel, one in each column


What about paste file{1,2}| column -s $'\t' -tn?

looooooooong line line  hello
line                    world
  • This is telling column to use Tab as columns' separator where we takes it from the paste command which is the default seperator there if not specified; generally:

    paste -d'X' file{1,2}| column -s $'X' -tn

    where X means any single character. You need to choose the one which granted that won't be occur in your files.

  • The -t option is used to determine the number of columns the input contains.

  • This will not add long tab between two files while other answers does.
  • this will work even if there was empty line(s) in file1 and it will not print second file in print area of file1, see below input/ouput

    Input file1:

    looooooooong line
    
    line
    

    Input file2:

    hello
    world
    

    Output:

    looooooooong line  hello
                       world
    line