|
Quick links About join Syntax
Related commands Linux / Unix main page
About join
The join command forms, on the standard output, a join of the two relations specified by the lines of file1 and file2.
Syntax
join [-a filenumber | -v filenumber ] [ -1 fieldnumber ]
[ -2 fieldnumber ] [ -o list ] [ -e string ] [ -t char ] file1 file2
join [ -a filenumber ] [ -j fieldnumber ] [-j1 fieldnumber ] [ -j2 fieldnumber ] [ -o list ] [-e string ] [ -t char ] file1 file2
| -a filenumber |
In addition to the normal output, produce a line for each unpairable line in file filenumber, where filenumber is 1 or 2. If both -a 1 and -a 2 are specified, all unpairable lines will be output. |
| -v filenumber |
Instead of the default output, produce a line only for each unpairable line in filenumber, where filenumber is 1 or 2. If both -v 1 and -v 2 are specified, all unpairable lines will be output. |
| -l fieldnumber |
Join on the fieldnumberth field of file 1 . Fields are decimal integers starting with 1. |
| -2 fieldnumber |
Join on the fieldnumberth field of file 2. Fields are decimal integers starting with 1. |
| -j fieldnumber |
Equivalent to -1fieldnumber -2fieldnumber. |
| -j1 fieldnumber |
Equivalent to -1fieldnumber. |
| -j2 fieldnumber |
Equivalent to -2fieldnumber Fields are numbered starting with 1. |
| -o list |
Each output line includes the fields specified in list. Fields selected by list that do not appear in the input will be treated as empty output fields. (See the -e option.) Each element of which has the either the form filenumber.fieldnumber, or 0, which represents the join field. The common field is not printed unless specifically requested. |
| -e string |
Replace empty output fields with string. |
| -t char |
Use character char as a separator. Every
appearance of char in a line is significant. The character char is used as the field separator for both input and output. With this option specified, the collating term should be the same as sort without the -b option. |
| file1
file2 |
File name and/or Directory and file
name of the files being joined |
Related commands
awk comm
sort split
uniq
|
|
| Resolved | Were you able to locate the answer to your questions? |
|
|