Also known as Join (UNIX)
command in Unix-like operating systems
The join utility shall perform an equality join on the files file1 and file2 . The joined files shall be written to the standard output. The join field is a field in each file on which the files are compared. The join utility shall write one line in the output for each pair of lines in file1 and file2 that have join fields that collate equally. The output line by default shall consist of the join field, then the remaining fields from file1 , then the remaining fields from file2 . This format can be changed by using the -o option (see below). The -a option can be used to add unmatched lines to the output. The -v option can be used to output only unmatched lines. The default input field separators shall be characters. In this case, multiple separators shall count as one field separator, and leading separators shall be ignored. The default output field separator shall be a . The field separator and collating sequence can be changed by using the -t option (see below). If the same key appears more than once in either file, all combinations of the set of remaining fields in file1 and the set of remaining fields in file2 are output in the order of the lines encountered. If the input files are not in the appropriate collating sequence, the results are unspecified. The standard input shall be used only if the file1 or file2 operand is '-'. See the INPUT FILES section. Provide a default value for the internationalization variables that are unset or null. (See XBD Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) If set to a non-empty string value, override the values of all the other internationalization variables. Determine the locale of the collating sequence join expects to have been used when the input files were sorted. Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments and input files). Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error. [XSI) ] ![[Option Start]]( Determine the location of message catalogs for the processing of LC MESSAGES. ![[Option End]]( For either format, each field (except the last) shall be written with its trailing separator character. If the separator is the default ( characters), a single shall be written after each field (except the last). If the collating sequence of the current locale does not have a total ordering of all characters (see XBD LC COLLATE ), join treats fields that collate equally but are not identical as being the same. If this behavior is not desired, it can be avoided by forcing the use of the POSIX locale (although this means re-sorting the input files into the POSIX locale collating sequence.) The -o 0 field essentially selects the union of the join fields. For example, given file phone : Multiple instances of the same key will produce combinatorial results. The following: The -e option is only effective when used with -o because, unless specific fields are identified using -o , join is not aware of what fields might be empty. The exception to this is the join field, but identifying an empty join field with the -e string is not historical practice and some scripts might break if this were changed. This sort of outer join was not possible with the join commands in the base documents for Base Definitions volume of POSIX.1-2017, Chapter 7, Locale . The -o 0 field was chosen because it is an upwards-compatible change for applications. An alternative was considered: have the join field represent the union of the fields in the files (where they are identical for matched lines, and one or both are null for unmatched lines). This was not adopted because it would break some historical applications. Some historical implementations have been encountered where a blank line in one of the input files was con
Excerpt from a page describing this subject · 15,164 chars · not written by Vinony
via Wikidata · CC0
via Wikidata sitelinks · CC0
Discovered by embedding cosine similarity (sentence-transformers MiniLM, 384-dim).