{
    "content": [
        {
            "type": "text",
            "text": "# uniq (man)\n\n## NAME\n\nuniq - report or omit repeated lines\n\n## SYNOPSIS\n\nuniq [OPTION]... [INPUT [OUTPUT]]\n\n## DESCRIPTION\n\nFilter adjacent matching lines from INPUT (or standard input), writing to OUTPUT (or standard\noutput).\n\n## TLDR\n\n> Output the unique lines from an input or file.\n\n- Display each line once:\n  `sort {{path/to/file}} | uniq`\n- Display only unique lines:\n  `sort {{path/to/file}} | uniq {{-u|--unique}}`\n- Display only duplicate lines:\n  `sort {{path/to/file}} | uniq {{-d|--repeated}}`\n- Display number of occurrences of each line along with that line:\n  `sort {{path/to/file}} | uniq {{-c|--count}}`\n- Display number of occurrences of each line, sorted by the most frequent:\n  `sort {{path/to/file}} | uniq {{-c|--count}} | sort {{-nr|--numeric-sort --reverse}}`\n- Compare only the first 10 characters on each line for uniqueness:\n  `sort {{path/to/file}} | uniq {{-w|--check-chars}} 10`\n- Compare text after the first 5 characters on each line for uniqueness:\n  `sort {{path/to/file}} | uniq {{-s|--skip-chars}} 5`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (10 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": "uniq",
        "section": "",
        "mode": "man",
        "summary": "uniq - report or omit repeated lines",
        "synopsis": "uniq [OPTION]... [INPUT [OUTPUT]]",
        "tldr_summary": "Output the unique lines from an input or file.",
        "tldr_examples": [
            {
                "description": "Display each line once",
                "command": "sort {{path/to/file}} | uniq"
            },
            {
                "description": "Display only unique lines",
                "command": "sort {{path/to/file}} | uniq {{-u|--unique}}"
            },
            {
                "description": "Display only duplicate lines",
                "command": "sort {{path/to/file}} | uniq {{-d|--repeated}}"
            },
            {
                "description": "Display number of occurrences of each line along with that line",
                "command": "sort {{path/to/file}} | uniq {{-c|--count}}"
            },
            {
                "description": "Display number of occurrences of each line, sorted by the most frequent",
                "command": "sort {{path/to/file}} | uniq {{-c|--count}} | sort {{-nr|--numeric-sort --reverse}}"
            },
            {
                "description": "Compare only the first 10 characters on each line for uniqueness",
                "command": "sort {{path/to/file}} | uniq {{-w|--check-chars}} 10"
            },
            {
                "description": "Compare text after the first 5 characters on each line for uniqueness",
                "command": "sort {{path/to/file}} | uniq {{-s|--skip-chars}} 5"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-c",
                "long": "--count",
                "arg": null,
                "description": "prefix lines by the number of occurrences"
            },
            {
                "flag": "-d",
                "long": "--repeated",
                "arg": null,
                "description": "only print duplicate lines, one for each group"
            },
            {
                "flag": "-D",
                "long": null,
                "arg": null,
                "description": "--all-repeated[=METHOD] like -D, but allow separating groups with an empty line; METHOD={none(de‐ fault),prepend,separate}"
            },
            {
                "flag": "-f",
                "long": "--skip-fields",
                "arg": null,
                "description": "avoid comparing the first N fields --group[=METHOD] show all items, separating groups with an empty line; METHOD={separate(de‐ fault),prepend,append,both}"
            },
            {
                "flag": "-i",
                "long": "--ignore-case",
                "arg": null,
                "description": "ignore differences in case when comparing"
            },
            {
                "flag": "-s",
                "long": "--skip-chars",
                "arg": null,
                "description": "avoid comparing the first N characters"
            },
            {
                "flag": "-u",
                "long": "--unique",
                "arg": null,
                "description": "only print unique lines"
            },
            {
                "flag": "-z",
                "long": "--zero-terminated",
                "arg": null,
                "description": "line delimiter is NUL, not newline"
            },
            {
                "flag": "-w",
                "long": "--check-chars",
                "arg": null,
                "description": "compare no more than N characters in lines --help display this help and exit"
            },
            {
                "flag": "",
                "long": "--version",
                "arg": null,
                "description": "output version information and exit A field is a run of blanks (usually spaces and/or TABs), then non-blank characters. Fields are skipped before chars. Note: 'uniq' does not detect repeated lines unless they are adjacent. You may want to sort the input first, or use 'sort -u' without 'uniq'."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "comm",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/comm/1/json"
            },
            {
                "name": "join",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/join/1/json"
            },
            {
                "name": "sort",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/sort/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 7,
                "subsections": [
                    {
                        "name": "-c --count",
                        "lines": 2,
                        "flag": "-c",
                        "long": "--count"
                    },
                    {
                        "name": "-d --repeated",
                        "lines": 2,
                        "flag": "-d",
                        "long": "--repeated"
                    },
                    {
                        "name": "-D",
                        "lines": 4,
                        "flag": "-D"
                    },
                    {
                        "name": "-f --skip-fields",
                        "lines": 6,
                        "flag": "-f",
                        "long": "--skip-fields"
                    },
                    {
                        "name": "-i --ignore-case",
                        "lines": 2,
                        "flag": "-i",
                        "long": "--ignore-case"
                    },
                    {
                        "name": "-s --skip-chars",
                        "lines": 2,
                        "flag": "-s",
                        "long": "--skip-chars"
                    },
                    {
                        "name": "-u --unique",
                        "lines": 2,
                        "flag": "-u",
                        "long": "--unique"
                    },
                    {
                        "name": "-z --zero-terminated",
                        "lines": 2,
                        "flag": "-z",
                        "long": "--zero-terminated"
                    },
                    {
                        "name": "-w --check-chars",
                        "lines": 4,
                        "flag": "-w",
                        "long": "--check-chars"
                    },
                    {
                        "name": "--version",
                        "lines": 8,
                        "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": "uniq - report or omit repeated lines\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "uniq [OPTION]... [INPUT [OUTPUT]]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Filter adjacent matching lines from INPUT (or standard input), writing to OUTPUT (or standard\noutput).\n\nWith no options, matching lines are merged to the first occurrence.\n\nMandatory arguments to long options are mandatory for short options too.\n",
                "subsections": [
                    {
                        "name": "-c --count",
                        "content": "prefix lines by the number of occurrences\n",
                        "flag": "-c",
                        "long": "--count"
                    },
                    {
                        "name": "-d --repeated",
                        "content": "only print duplicate lines, one for each group\n",
                        "flag": "-d",
                        "long": "--repeated"
                    },
                    {
                        "name": "-D",
                        "content": "--all-repeated[=METHOD]\nlike  -D,  but  allow  separating  groups  with  an   empty   line;   METHOD={none(de‐\nfault),prepend,separate}\n",
                        "flag": "-D"
                    },
                    {
                        "name": "-f --skip-fields",
                        "content": "avoid comparing the first N fields\n\n--group[=METHOD]\nshow   all   items,   separating  groups  with  an  empty  line;  METHOD={separate(de‐\nfault),prepend,append,both}\n",
                        "flag": "-f",
                        "long": "--skip-fields"
                    },
                    {
                        "name": "-i --ignore-case",
                        "content": "ignore differences in case when comparing\n",
                        "flag": "-i",
                        "long": "--ignore-case"
                    },
                    {
                        "name": "-s --skip-chars",
                        "content": "avoid comparing the first N characters\n",
                        "flag": "-s",
                        "long": "--skip-chars"
                    },
                    {
                        "name": "-u --unique",
                        "content": "only print unique lines\n",
                        "flag": "-u",
                        "long": "--unique"
                    },
                    {
                        "name": "-z --zero-terminated",
                        "content": "line delimiter is NUL, not newline\n",
                        "flag": "-z",
                        "long": "--zero-terminated"
                    },
                    {
                        "name": "-w --check-chars",
                        "content": "compare no more than N characters in lines\n\n--help display this help and exit\n",
                        "flag": "-w",
                        "long": "--check-chars"
                    },
                    {
                        "name": "--version",
                        "content": "output version information and exit\n\nA field is a run of blanks (usually spaces and/or TABs), then non-blank  characters.   Fields\nare skipped before chars.\n\nNote:  'uniq'  does not detect repeated lines unless they are adjacent.  You may want to sort\nthe input first, or use 'sort -u' without 'uniq'.\n",
                        "long": "--version"
                    }
                ]
            },
            "AUTHOR": {
                "content": "Written by Richard M. Stallman and David MacKenzie.\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), join(1), sort(1)\n\nFull documentation <https://www.gnu.org/software/coreutils/uniq>\nor available locally via: info '(coreutils) uniq invocation'\n\n\n\nGNU coreutils 8.32                          January 2026                                     UNIQ(1)",
                "subsections": []
            }
        }
    }
}