Linux Command Cheat Sheet/Join two files on a common field

Relational join for sorted text files.

Section: sed awk and Structured Text Workflows

Join two files on a common field

bash
bash
join -1 1 -2 1 users.txt emails.txt
Explanation

Useful when doing small-scale data joins in shell pipelines.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing sed awk and Structured Text Workflows
Print file contents
Concatenate and print files to standard output.
OpenIn sheetbash1 tag match
Search text with grep
Print lines matching a pattern.
OpenIn sheetbash1 tag match
Show first lines
Display the first lines of a file.
OpenIn sheetbash1 tag match
Show last lines
Display the end of a file.
OpenIn sheetbash1 tag match
Count lines words and bytes
Count content in files or streams.
OpenIn sheetbash1 tag match
Number lines
Display file contents with line numbers.
OpenIn sheetbash1 tag match