{
    "mode": "info",
    "parameter": "unexpand",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/unexpand/json",
    "generated": "2026-11-09T23:57:43Z",
    "sections": {
        "File: coreutils.info,  Node: unexpand invocation,  Prev: expand invocation,  Up: Operating on characters": {
            "content": "",
            "subsections": [
                {
                    "name": "9.3 'unexpand': Convert spaces to tabs",
                    "content": "'unexpand' writes the contents of each given FILE, or standard input if\nnone are given or for a FILE of '-', to standard output, converting\nblanks at the beginning of each line into as many tab characters as\nneeded.  In the default POSIX locale, a \"blank\" is a space or a tab;\nother locales may specify additional blank characters.  Synopsis:\n\nunexpand [OPTION]... [FILE]...\n\nBy default, 'unexpand' converts only initial blanks (those that\nprecede all non-blank characters) on each line.  It preserves backspace\ncharacters in the output; they decrement the column count for tab\ncalculations.  By default, tabs are set at every 8th column.\n\nThe program accepts the following options.  Also see *note Common\noptions::.\n\n'-t TAB1[,TAB2]...'\n'--tabs=TAB1[,TAB2]...'\nIf only one tab stop is given, set the tabs TAB1 columns apart\ninstead of the default 8.  Otherwise, set the tabs at columns TAB1,\nTAB2, ... (numbered from 0), and leave blanks beyond the tab stops\ngiven unchanged.  Tab stops can be separated by blanks as well as\nby commas.\n\nAs a GNU extension the last TAB specified can be prefixed with a\n'/' to indicate a tab size to use for remaining positions.  For\nexample, '--tabs=2,4,/8' will set tab stops at position 2 and 4,\nand every multiple of 8 after that.\n\nAlso the last TAB specified can be prefixed with a '+' to indicate\na tab size to use for remaining positions, offset from the final\nexplicitly specified tab stop.  For example, to ignore the 1\ncharacter gutter present in diff output, one can specify a 1\ncharacter offset using '--tabs=1,+8', which will set tab stops at\npositions 1,9,17,...\n\nThis option implies the '-a' option.\n\nFor compatibility, GNU 'unexpand' supports the obsolete option\nsyntax, '-TAB1[,TAB2]...', where tab stops must be separated by\ncommas.  (Unlike '-t', this obsolete option does not imply '-a'.)\nNew scripts should use '--first-only -t TAB1[,TAB2]...' instead.\n\n'-a'\n'--all'\nAlso convert all sequences of two or more blanks just before a tab\nstop, even if they occur after non-blank characters in a line.\n\nAn exit status of zero indicates success, and a nonzero value\nindicates failure.\n"
                }
            ]
        }
    },
    "flags": [],
    "examples": [],
    "see_also": []
}