Convert spaces to tabs (POSIX)
unexpand [-a] [-t tabsize] [file...]
- In addition to the default behavior of replacing leading spaces, translate two to eight consecutive spaces immediately preceding a tab stop into a tab. A tab stop is a column position that's a multiple of eight column positions.
- -t tabsize
- (QNX Neutrino extension) Set the tab stops tabsize columns apart (default is 8). The tabsize argument consists of a single positive decimal integer.
- The pathname of a text file to be used as input.
The unexpand utility copies files or the standard input to the standard output, translating each group of eight spaces at the beginning of a line into a tab character. Any backspace characters in the input are copied to the output, and each causes the column position count for tab calculations to be decremented; the count is never decremented below zero.
For the file sourcecode, convert every run of eight spaces at the beginning of a line into a single tab:
Convert every run of two to eight spaces that precedes a tab stop into a single tab:
unexpand -a sourcecode
Convert every run of two to four spaces that precedes a tab stop into a single tab:
unexpand -a -t4 sourcecode
- Successful completion.
- An error occurred.