join |
---|
|
join [ options ... ] file1 file2 |
---|
|
To merge records in sorted files based on a common key. |
---|
|
-1 field1 |
---|
-2 field2 |
---|
Specifies the fields on which to join. -1 field1 specifies field1 from file1, and -2 field2 specifies field2 from file2. Fields are numbered from one, not from zero. |
---|
-o file.field |
---|
Make the output consist of field field from file file. The common field is not printed unless requested explicitly. Use multiple -o options to print multiple output fields. |
---|
-t separator |
---|
Use separator as the input field separator instead of whitespace. This character becomes the output field separator as well. |
---|
|
Read file1 and file2, merging records based on a common key. By default, runs of whitespace separate fields. The output consists of the common key, the rest of the record from file1, followed by the rest of the record from file2. If file1 is -, join reads standard input. The first field of each file is the default key upon which to join; this can be changed with -1 and -2. Lines without keys in both files are not printed by default. (Options exist to change this; see the manual pages for join(1).) |
---|
|
The -1 and -2 options are relatively new. On older systems, you may need to use -j1 field1 and -j2 field2. |
---|