- About join : Join lines of two files on a common field
- It comes from “coreutils-8.4” package.
– Path: /usr/bin/join
Examples:
1. To join and show the common lines from given input files
$ join file1.txt file2.txt |
2. To print the unpairable lines from specified file
$ join -a 1 $ join -a 2 |
3. To replace the missing fields with empty
$ join -e EMPTY |
4. To ignore the case difference when comparing
$ join -i file1.txt file2.txt $ join –ignore-case file1.txt file2.txt |
5. To obey format while constructing output
$ join -o FORMAT file1.txt file2.txt |
6. To use the CHAR as input and output field separator
$ join -r CHAR file1.txt file2.txt |
7. To print unpairable and suppress joined
$ join -v 1 file1.txt file2.txt |
8. To check the input is sorted
$ join –check-order file1.txt file2.txt |
9. To not to check the input is sorted
$ join –nocheck-order file1.txt file2.txt |
10. To display the help and exit
$ join –help |
11. To get the version info
$ join –version |
Related Commands: comm, uniq