Join command in Linux (join files)
The join command in Linux (join) joins the lines of both files that have a common index. The join command can be used as a simple database.
The commonly used options are:
- -j1 number: Choose the number field as the index for file1.
- -j2 number: Choose the number field as the index for file2.
- -j number: Choose the number field as the index for both files.
Example:
Assume that file1 contains the following content:
And file 2 has the following content:
After the command:
$ join —j 1 file1 file2
The output will be as follows:
TABLE - Symbols to differentiate header and footer
Symbol | Description |
::: | Symbol used to start the text header |
:: | Symbol used to start the text body |
: | Symbol used to start the text footer |
Learn much more about Linux in our online course. You can register here. If you already have an account, or want to create one, just log in or create your user here.
Did you like it?
Share