Join command is used to join two files based on a key field present in both the files, the input files can be separated by space or any delimiter. Join can be looked at like the join functionality in any Relational database. However, the only difference being in the database join we get only the columns which we give in the select clause, in case of unix join, you get all the columns of both the files.
The syntax for join command is
The options are
- -1 field number : Join on the specified field number in the first file
- -2 field number : Join on the specified field number in the second file
- -j field number : Equivalent to -1 fieldnumber and -2 fieldnumber
- -o list : displays only the specified fields from both the files
- -t char : input and output field delimiter
- -a filenumber : Prints non matched lines in a file
- -i : ignore case while joining
- -header: Treat the first line in each file as file headers, print them with out trying to pair it.
Examples of Join command
We have two inputs(Tables)
- Join two files

- Join two delimiter files

join command is

