Previous: paste invocation, Up: Operating on fields [Contents][Index]
join
: Join lines on a common fieldjoin
writes to standard output a line for each pair of input
lines that have identical join fields. Synopsis:
join [option]… file1 file2
Either file1 or file2 (but not both) can be ‘-’, meaning standard input. file1 and file2 should be sorted on the join fields.
$ cat file1 a 1 b 2 e 5 $ cat file2 a X e Y f Z $ join file1 file2 a 1 X e 5 Y
join
’s default behavior (when no options are given):
• General options in join: | Options which affect general program behavior. | |
• Sorting files for join: | Using sort before join .
| |
• Working with fields: | Joining on different fields. | |
• Paired and unpaired lines: | Controlling join ’s field matching.
| |
• Header lines: | Working with header lines in files. | |
• Set operations: | Union, Intersection and Difference of files. |