join
FilesAdvanced In simulator In real LinuxJoin lines of two sorted files on a common field
Name: join: like a database JOIN
You can practise it right away in the simulator, and use it in real Linux mode too.
Description
join merges lines of two files that share a common field, like a database JOIN. Both files must be sorted on that field first.
Syntax
join [OPTION]... FILE1 FILE2Common options
| -t CHAR | Field separator |
| -1 FIELD | Join field of FILE1 |
| -2 FIELD | Join field of FILE2 |
| -a FILENUM | Also print the unpaired lines of file FILENUM (1 or 2) |
| -v FILENUM | Print only the unpaired lines of file FILENUM |
| -i / --ignore-case | Ignore case when comparing |
| -o FORMAT | Choose the output fields, e.g. -o 1.1,2.2 |
Examples
$ join -t, users.csv orders.csv
Join two CSVs on their first field
Explain