commands

unexpand — convert suitable blanks to tabs

Convert leading blanks by default; -a includes other blanks, -t N uses tab stops every N columns (also implies -a in GNU). Not a byte-exact inverse of expand. Example assumes a fresh text-streams lab fixture.

Formal Syntax & Structure

linux syntaxlinux
unexpand [OPTION]... [FILE]...

Parameters & Attributes

NameTypeDescription
-aoptionConvert all suitable blanks
-toptionTab stop spacing
FILEoperandInput file

Return Value

exit status and output

GNU unexpand writes text with eligible blank sequences converted to tabs and returns nonzero on errors. A successful result is not necessarily byte-identical to the input after a round trip through expand.

Working Example

Example Snippetlinux
unexpand -a -t 4 spaces.txt
Linux Reference