unexpand

Convert spaces to tabs (POSIX)

Syntax:

unexpand [-a] [-t tabsize] [file...]

Runs on:

Neutrino

Options:

-a
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.
file
The pathname of a text file to be used as input.

Description:

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.

Examples:

For the file sourcecode, convert every run of eight spaces at the beginning of a line into a single tab:

unexpand sourcecode

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

Exit status:

0
Successful completion.
>0
An error occurred.

See also:

expand