Text Processing

join

Joins sorted files on a common field.

join combines records from two sorted files where a selected field matches.

Syntax
join [options] file1 file2

Arguments explained

  • Options adjust output or behavior.
  • Arguments name the files, services, hosts, or values the command should work with.

Common examples

Join two sorted files
join users.txt departments.txt

Combines lines with matching first fields.

Join on a field
join -1 1 -2 2 a.txt b.txt

Uses field 1 from a.txt and field 2 from b.txt.

join Command
FieldDetails
Commandjoin
CategoryText Processing
Primary useJoins sorted files on a common field.
Syntaxjoin [options] file1 file2