sort -k2 -o file1 file1 sort -k2 -o file2 file2 join -j 2 -t ' ' file1 file2 # inserted a tab between the quotes with Ctrl-V