{
    "content": [
        {
            "type": "text",
            "text": "# tr (man)\n\n## NAME\n\ntr - translate or delete characters\n\n## SYNOPSIS\n\ntr [OPTION]... SET1 [SET2]\n\n## DESCRIPTION\n\nTranslate, squeeze, and/or delete characters from standard input, writing to standard output.\n\n## TLDR\n\n> Translate characters: run replacements based on single characters and character sets.\n\n- Replace all occurrences of a character in a file, and print the result:\n  `tr < {{path/to/file}} {{find_character}} {{replace_character}}`\n- Replace all occurrences of a character from another command's output:\n  `echo {{text}} | tr {{find_character}} {{replace_character}}`\n- Map each character of the first set to the corresponding character of the second set:\n  `tr < {{path/to/file}} '{{abcd}}' '{{jkmn}}'`\n- Delete all occurrences of the specified set of characters from the input:\n  `tr < {{path/to/file}} {{-d|--delete}} '{{input_characters}}'`\n- Compress a series of identical characters to a single character:\n  `tr < {{path/to/file}} {{-s|--squeeze-repeats}} '{{input_characters}}'`\n- Translate the contents of a file to upper-case:\n  `tr < {{path/to/file}} \"[:lower:]\" \"[:upper:]\"`\n- Strip out non-printable characters from a file:\n  `tr < {{path/to/file}} {{-cd|--complement --delete}} \"[:print:]\"`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (5 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": "tr",
        "section": "",
        "mode": "man",
        "summary": "tr - translate or delete characters",
        "synopsis": "tr [OPTION]... SET1 [SET2]",
        "tldr_summary": "Translate characters: run replacements based on single characters and character sets.",
        "tldr_examples": [
            {
                "description": "Replace all occurrences of a character in a file, and print the result",
                "command": "tr < {{path/to/file}} {{find_character}} {{replace_character}}"
            },
            {
                "description": "Replace all occurrences of a character from another command's output",
                "command": "echo {{text}} | tr {{find_character}} {{replace_character}}"
            },
            {
                "description": "Map each character of the first set to the corresponding character of the second set",
                "command": "tr < {{path/to/file}} '{{abcd}}' '{{jkmn}}'"
            },
            {
                "description": "Delete all occurrences of the specified set of characters from the input",
                "command": "tr < {{path/to/file}} {{-d|--delete}} '{{input_characters}}'"
            },
            {
                "description": "Compress a series of identical characters to a single character",
                "command": "tr < {{path/to/file}} {{-s|--squeeze-repeats}} '{{input_characters}}'"
            },
            {
                "description": "Translate the contents of a file to upper-case",
                "command": "tr < {{path/to/file}} \"[:lower:]\" \"[:upper:]\""
            },
            {
                "description": "Strip out non-printable characters from a file",
                "command": "tr < {{path/to/file}} {{-cd|--complement --delete}} \"[:print:]\""
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-C",
                "long": "--complement",
                "arg": null,
                "description": "use the complement of SET1"
            },
            {
                "flag": "-d",
                "long": "--delete",
                "arg": null,
                "description": "delete characters in SET1, do not translate"
            },
            {
                "flag": "-s",
                "long": "--squeeze-repeats",
                "arg": null,
                "description": "replace each sequence of a repeated character that is listed in the last specified SET, with a single occurrence of that character"
            },
            {
                "flag": "-t",
                "long": "--truncate-set1",
                "arg": null,
                "description": "first truncate SET1 to length of SET2 --help display this help and exit"
            },
            {
                "flag": "",
                "long": "--version",
                "arg": null,
                "description": "output version information and exit SETs are specified as strings of characters. Most represent themselves. Interpreted se‐ quences are: \\NNN character with octal value NNN (1 to 3 octal digits) \\\\ backslash \\a audible BEL \\b backspace \\f form feed \\n new line \\r return \\t horizontal tab \\v vertical tab CHAR1-CHAR2 all characters from CHAR1 to CHAR2 in ascending order [CHAR*] in SET2, copies of CHAR until length of SET1 [CHAR*REPEAT] REPEAT copies of CHAR, REPEAT octal if starting with 0 [:alnum:] all letters and digits [:alpha:] all letters [:blank:] all horizontal whitespace [:cntrl:] all control characters [:digit:] all digits [:graph:] all printable characters, not including space [:lower:] all lower case letters [:print:] all printable characters, including space [:punct:] all punctuation characters [:space:] all horizontal or vertical whitespace [:upper:] all upper case letters [:xdigit:] all hexadecimal digits [=CHAR=] all characters which are equivalent to CHAR Translation occurs if -d is not given and both SET1 and SET2 appear. -t may be used only when translating. SET2 is extended to length of SET1 by repeating its last character as nec‐ essary. Excess characters of SET2 are ignored. Only [:lower:] and [:upper:] are guaranteed to expand in ascending order; used in SET2 while translating, they may only be used in pairs to specify case conversion. -s uses the last specified SET, and occurs after translation or deletion."
            }
        ],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 2,
                "subsections": [
                    {
                        "name": "-c -C --complement",
                        "lines": 2,
                        "flag": "-C",
                        "long": "--complement"
                    },
                    {
                        "name": "-d --delete",
                        "lines": 2,
                        "flag": "-d",
                        "long": "--delete"
                    },
                    {
                        "name": "-s --squeeze-repeats",
                        "lines": 3,
                        "flag": "-s",
                        "long": "--squeeze-repeats"
                    },
                    {
                        "name": "-t --truncate-set1",
                        "lines": 4,
                        "flag": "-t",
                        "long": "--truncate-set1"
                    },
                    {
                        "name": "--version",
                        "lines": 78,
                        "long": "--version"
                    }
                ]
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "REPORTING BUGS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 6,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "tr - translate or delete characters\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "tr [OPTION]... SET1 [SET2]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Translate, squeeze, and/or delete characters from standard input, writing to standard output.\n",
                "subsections": [
                    {
                        "name": "-c -C --complement",
                        "content": "use the complement of SET1\n",
                        "flag": "-C",
                        "long": "--complement"
                    },
                    {
                        "name": "-d --delete",
                        "content": "delete characters in SET1, do not translate\n",
                        "flag": "-d",
                        "long": "--delete"
                    },
                    {
                        "name": "-s --squeeze-repeats",
                        "content": "replace  each  sequence  of  a repeated character that is listed in the last specified\nSET, with a single occurrence of that character\n",
                        "flag": "-s",
                        "long": "--squeeze-repeats"
                    },
                    {
                        "name": "-t --truncate-set1",
                        "content": "first truncate SET1 to length of SET2\n\n--help display this help and exit\n",
                        "flag": "-t",
                        "long": "--truncate-set1"
                    },
                    {
                        "name": "--version",
                        "content": "output version information and exit\n\nSETs are specified as strings of characters.  Most  represent  themselves.   Interpreted  se‐\nquences are:\n\n\\NNN   character with octal value NNN (1 to 3 octal digits)\n\n\\\\     backslash\n\n\\a     audible BEL\n\n\\b     backspace\n\n\\f     form feed\n\n\\n     new line\n\n\\r     return\n\n\\t     horizontal tab\n\n\\v     vertical tab\n\nCHAR1-CHAR2\nall characters from CHAR1 to CHAR2 in ascending order\n\n[CHAR*]\nin SET2, copies of CHAR until length of SET1\n\n[CHAR*REPEAT]\nREPEAT copies of CHAR, REPEAT octal if starting with 0\n\n[:alnum:]\nall letters and digits\n\n[:alpha:]\nall letters\n\n[:blank:]\nall horizontal whitespace\n\n[:cntrl:]\nall control characters\n\n[:digit:]\nall digits\n\n[:graph:]\nall printable characters, not including space\n\n[:lower:]\nall lower case letters\n\n[:print:]\nall printable characters, including space\n\n[:punct:]\nall punctuation characters\n\n[:space:]\nall horizontal or vertical whitespace\n\n[:upper:]\nall upper case letters\n\n[:xdigit:]\nall hexadecimal digits\n\n[=CHAR=]\nall characters which are equivalent to CHAR\n\nTranslation  occurs  if  -d  is not given and both SET1 and SET2 appear.  -t may be used only\nwhen translating.  SET2 is extended to length of SET1 by repeating its last character as nec‐\nessary.   Excess characters of SET2 are ignored.  Only [:lower:] and [:upper:] are guaranteed\nto expand in ascending order; used in SET2 while translating, they may only be used in  pairs\nto  specify case conversion.  -s uses the last specified SET, and occurs after translation or\ndeletion.\n",
                        "long": "--version"
                    }
                ]
            },
            "AUTHOR": {
                "content": "Written by Jim Meyering.\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": "Full documentation <https://www.gnu.org/software/coreutils/tr>\nor available locally via: info '(coreutils) tr invocation'\n\n\n\nGNU coreutils 8.32                          January 2026                                       TR(1)",
                "subsections": []
            }
        }
    }
}