{
    "content": [
        {
            "type": "text",
            "text": "# join (man)\n\n## NAME\n\njoin - join lines of two files on a common field\n\n## SYNOPSIS\n\njoin [OPTION]... FILE1 FILE2\n\n## DESCRIPTION\n\nFor  each  pair  of  input lines with identical join fields, write a line to standard output.\nThe default join field is the first, delimited by blanks.\n\n## TLDR\n\n> Join lines of two sorted files on a common field.\n\n- Join two files on the first (default) field:\n  `join {{path/to/file1}} {{path/to/file2}}`\n- Join two files using a comma (instead of a space) as the field separator:\n  `join -t ',' {{path/to/file1}} {{path/to/file2}}`\n- Join field3 of file1 with field1 of file2:\n  `join -1 {{3}} -2 {{1}} {{path/to/file1}} {{path/to/file2}}`\n- Produce a line for each unpairable line for file1:\n  `join -a {{1}} {{path/to/file1}} {{path/to/file2}}`\n- Join a file from `stdin`:\n  `cat {{path/to/file1}} | join - {{path/to/file2}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (14 subsections)\n- **AUTHOR**\n- **REPORTING BUGS**\n- **COPYRIGHT**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "join",
        "section": "",
        "mode": "man",
        "summary": "join - join lines of two files on a common field",
        "synopsis": "join [OPTION]... FILE1 FILE2",
        "tldr_summary": "Join lines of two sorted files on a common field.",
        "tldr_examples": [
            {
                "description": "Join two files on the first (default) field",
                "command": "join {{path/to/file1}} {{path/to/file2}}"
            },
            {
                "description": "Join two files using a comma (instead of a space) as the field separator",
                "command": "join -t ',' {{path/to/file1}} {{path/to/file2}}"
            },
            {
                "description": "Join field3 of file1 with field1 of file2",
                "command": "join -1 {{3}} -2 {{1}} {{path/to/file1}} {{path/to/file2}}"
            },
            {
                "description": "Produce a line for each unpairable line for file1",
                "command": "join -a {{1}} {{path/to/file1}} {{path/to/file2}}"
            },
            {
                "description": "Join a file from `stdin`",
                "command": "cat {{path/to/file1}} | join - {{path/to/file2}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-a",
                "long": null,
                "arg": null,
                "description": "also print unpairable lines from file FILENUM, where FILENUM is 1 or 2, corresponding to FILE1 or FILE2"
            },
            {
                "flag": "-e",
                "long": null,
                "arg": null,
                "description": "replace missing input fields with EMPTY"
            },
            {
                "flag": "-i",
                "long": "--ignore-case",
                "arg": null,
                "description": "ignore differences in case when comparing fields"
            },
            {
                "flag": "-j",
                "long": null,
                "arg": null,
                "description": "equivalent to '-1 FIELD -2 FIELD'"
            },
            {
                "flag": "-o",
                "long": null,
                "arg": null,
                "description": "obey FORMAT while constructing output line"
            },
            {
                "flag": "-t",
                "long": null,
                "arg": null,
                "description": "use CHAR as input and output field separator"
            },
            {
                "flag": "-v",
                "long": null,
                "arg": null,
                "description": "like -a FILENUM, but suppress joined output lines"
            },
            {
                "flag": "-1",
                "long": null,
                "arg": null,
                "description": "join on this FIELD of file 1"
            },
            {
                "flag": "-2",
                "long": null,
                "arg": null,
                "description": "join on this FIELD of file 2"
            },
            {
                "flag": "",
                "long": "--check-order",
                "arg": null,
                "description": "check that the input is correctly sorted, even if all input lines are pairable"
            },
            {
                "flag": "",
                "long": "--nocheck-order",
                "arg": null,
                "description": "do not check that the input is correctly sorted"
            },
            {
                "flag": "",
                "long": "--header",
                "arg": null,
                "description": "treat the first line in each file as field headers, print them without trying to pair them"
            },
            {
                "flag": "-z",
                "long": "--zero-terminated",
                "arg": null,
                "description": "line delimiter is NUL, not newline --help display this help and exit"
            },
            {
                "flag": "",
                "long": "--version",
                "arg": null,
                "description": "output version information and exit Unless -t CHAR is given, leading blanks separate fields and are ignored, else fields are sep‐ arated by CHAR. Any FIELD is a field number counted from 1. FORMAT is one or more comma or blank separated specifications, each being 'FILENUM.FIELD' or '0'. Default FORMAT outputs the join field, the remaining fields from FILE1, the remaining fields from FILE2, all sepa‐ rated by CHAR. If FORMAT is the keyword 'auto', then the first line of each file determines the number of fields output for each line. Important: FILE1 and FILE2 must be sorted on the join fields. E.g., use \"sort -k 1b,1\" if 'join' has no options, or use \"join -t ''\" if 'sort' has no options. Note, comparisons honor the rules specified by 'LCCOLLATE'. If the input is not sorted and some lines cannot be joined, a warning message will be given."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "comm",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/comm/1/json"
            },
            {
                "name": "uniq",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/uniq/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 5,
                "subsections": [
                    {
                        "name": "-a",
                        "lines": 3,
                        "flag": "-a"
                    },
                    {
                        "name": "-e",
                        "lines": 2,
                        "flag": "-e"
                    },
                    {
                        "name": "-i --ignore-case",
                        "lines": 2,
                        "flag": "-i",
                        "long": "--ignore-case"
                    },
                    {
                        "name": "-j",
                        "lines": 2,
                        "flag": "-j"
                    },
                    {
                        "name": "-o",
                        "lines": 2,
                        "flag": "-o"
                    },
                    {
                        "name": "-t",
                        "lines": 2,
                        "flag": "-t"
                    },
                    {
                        "name": "-v",
                        "lines": 2,
                        "flag": "-v"
                    },
                    {
                        "name": "-1",
                        "lines": 2,
                        "flag": "-1"
                    },
                    {
                        "name": "-2",
                        "lines": 2,
                        "flag": "-2"
                    },
                    {
                        "name": "--check-order",
                        "lines": 2,
                        "long": "--check-order"
                    },
                    {
                        "name": "--nocheck-order",
                        "lines": 2,
                        "long": "--nocheck-order"
                    },
                    {
                        "name": "--header",
                        "lines": 3,
                        "long": "--header"
                    },
                    {
                        "name": "-z --zero-terminated",
                        "lines": 4,
                        "flag": "-z",
                        "long": "--zero-terminated"
                    },
                    {
                        "name": "--version",
                        "lines": 14,
                        "long": "--version"
                    }
                ]
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "REPORTING BUGS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 8,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "join - join lines of two files on a common field\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "join [OPTION]... FILE1 FILE2\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "For  each  pair  of  input lines with identical join fields, write a line to standard output.\nThe default join field is the first, delimited by blanks.\n\nWhen FILE1 or FILE2 (not both) is -, read standard input.\n",
                "subsections": [
                    {
                        "name": "-a",
                        "content": "also print unpairable lines from file FILENUM, where FILENUM is 1 or 2,  corresponding\nto FILE1 or FILE2\n",
                        "flag": "-a"
                    },
                    {
                        "name": "-e",
                        "content": "replace missing input fields with EMPTY\n",
                        "flag": "-e"
                    },
                    {
                        "name": "-i --ignore-case",
                        "content": "ignore differences in case when comparing fields\n",
                        "flag": "-i",
                        "long": "--ignore-case"
                    },
                    {
                        "name": "-j",
                        "content": "equivalent to '-1 FIELD -2 FIELD'\n",
                        "flag": "-j"
                    },
                    {
                        "name": "-o",
                        "content": "obey FORMAT while constructing output line\n",
                        "flag": "-o"
                    },
                    {
                        "name": "-t",
                        "content": "use CHAR as input and output field separator\n",
                        "flag": "-t"
                    },
                    {
                        "name": "-v",
                        "content": "like -a FILENUM, but suppress joined output lines\n",
                        "flag": "-v"
                    },
                    {
                        "name": "-1",
                        "content": "join on this FIELD of file 1\n",
                        "flag": "-1"
                    },
                    {
                        "name": "-2",
                        "content": "join on this FIELD of file 2\n",
                        "flag": "-2"
                    },
                    {
                        "name": "--check-order",
                        "content": "check that the input is correctly sorted, even if all input lines are pairable\n",
                        "long": "--check-order"
                    },
                    {
                        "name": "--nocheck-order",
                        "content": "do not check that the input is correctly sorted\n",
                        "long": "--nocheck-order"
                    },
                    {
                        "name": "--header",
                        "content": "treat  the first line in each file as field headers, print them without trying to pair\nthem\n",
                        "long": "--header"
                    },
                    {
                        "name": "-z --zero-terminated",
                        "content": "line delimiter is NUL, not newline\n\n--help display this help and exit\n",
                        "flag": "-z",
                        "long": "--zero-terminated"
                    },
                    {
                        "name": "--version",
                        "content": "output version information and exit\n\nUnless -t CHAR is given, leading blanks separate fields and are ignored, else fields are sep‐\narated  by CHAR.  Any FIELD is a field number counted from 1.  FORMAT is one or more comma or\nblank separated specifications, each being 'FILENUM.FIELD' or '0'.   Default  FORMAT  outputs\nthe  join  field, the remaining fields from FILE1, the remaining fields from FILE2, all sepa‐\nrated by CHAR.  If FORMAT is the keyword 'auto', then the first line of each file  determines\nthe number of fields output for each line.\n\nImportant:  FILE1  and  FILE2 must be sorted on the join fields.  E.g., use \"sort -k 1b,1\" if\n'join' has no options, or use \"join -t ''\" if 'sort' has no options.  Note, comparisons honor\nthe  rules  specified  by  'LCCOLLATE'.  If the input is not sorted and some lines cannot be\njoined, a warning message will be given.\n",
                        "long": "--version"
                    }
                ]
            },
            "AUTHOR": {
                "content": "Written by Mike Haertel.\n",
                "subsections": []
            },
            "REPORTING BUGS": {
                "content": "GNU coreutils online help: <https://www.gnu.org/software/coreutils/>\nReport any translation bugs to <https://translationproject.org/team/>\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright © 2020 Free Software Foundation, Inc.  License GPLv3+: GNU GPL version 3  or  later\n<https://gnu.org/licenses/gpl.html>.\nThis  is free software: you are free to change and redistribute it.  There is NO WARRANTY, to\nthe extent permitted by law.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "comm(1), uniq(1)\n\nFull documentation <https://www.gnu.org/software/coreutils/join>\nor available locally via: info '(coreutils) join invocation'\n\n\n\nGNU coreutils 8.32                          January 2026                                     JOIN(1)",
                "subsections": []
            }
        }
    }
}