Join lines of two sorted files on a common field. More information: https://www.gnu.org/software/coreutils/join.
join path/to/file1 path/to/file2
join -t ',' path/to/file1 path/to/file2
join -1 3 -2 1 path/to/file1 path/to/file2
join -a 1 path/to/file1 path/to/file2
stdin
:cat path/to/file1 | join - path/to/file2