expand [ -tabstop ] [ -tab1, tab2, ..., tabn ] [ file ]
unexpand [-a | -t tablist ] [ file ... ]
expand reads either its standard input or the named files, replaces all tabs with spaces, and writes its output to the standard output. When a backspace character is encountered the column count is decremented (for tab stop calculations) and the backspace character is copied to the standard output unchanged.
The second form of expand uses a single number to specify the tab interval, tabstop, preceded by a minus sign. Multiple tab stops are specified after a leading minus sign as tab1, tab2 and so on.
unexpand reads the standard input or the named files, and replaces leading blanks with the maximum number of tabs followed by the minimum number of spaces necessary to provide an equivalent indentation. The output is then written to the standard output. If a backspace character is encountered in the input, unexpand decrements its column counter then copies the backspace character to the output.
By default, tab stops are set at every eighth column position.
The following options are recognized:
When the -t option is used for unexpand, -a is assumed.
Convert spaces to tabs in txtfile, and send output to
tabbed.file:
unexpand <txtfile >tabbed.file
ISO/IEC DIS 9945-2:1992, Information technology - Portable Operating System Interface (POSIX) - Part 2: Shell and Utilities (IEEE Std 1003.2-1992);
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.
SCO OpenServer Release 5.0.6 -- 1 August 2000