join
Merge two sorted files by matching a shared field. Returns JSON with combined records. Pre-sort input using 'sort' beforehand.
Instructions
Join two sorted files on a common field (default: first whitespace-separated field), performing an inner join. Read-only, no side effects. Requires pre-sorted input — use 'sort' first. Returns JSON with joined records. Use to combine related datasets by key. Not for unsorted input — results are wrong without prior sorting. Not for side-by-side merging without key matching — use 'paste'. See also 'paste', 'comm', 'sort'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| raw | No | Write joined text without a JSON envelope. | |
| paths | Yes | Two files to join. | |
| field1 | No | 1-based join field for the first file. | |
| field2 | No | 1-based join field for the second file. | |
| encoding | No | Text encoding (default: utf-8). Use 'auto' for BOM/autodetection. | utf-8 |
| delimiter | No | Input delimiter. Defaults to any whitespace. | |
| max_lines | No | Maximum JSON records to emit. | |
| show_encoding | No | Include encoding detection metadata in JSON result. | |
| encoding_errors | No | How to handle encoding errors (default: replace). | replace |
| encoding_profile | No | Locale-aware encoding fallback profile for auto-detection. | |
| output_delimiter | No | Delimiter for output fields. |