unexpand
unexpand [OPTION]... [FILE]...
Convert blanks in each FILE to tabs, writing to standard output. With no FILE, or when FILE is -, read standard input.
Options
--all,-a-
convert all blanks, instead of just initial blanks
--first-only,-f-
convert only leading sequences of blanks (overrides -a)
--tabs=<N, LIST>,-t <N, LIST>-
use comma separated LIST of tab positions or have tabs N characters apart instead of 8 (enables -a)
--no-utf8,-U-
interpret input file as 8-bit ASCII rather than UTF-8
Examples
Convert blanks in each file to tabs, writing to stdout:
unexpand {{path/to/file}}
Convert blanks to tabs, reading from stdout:
unexpand
Convert all blanks, instead of just initial blanks:
unexpand {{[-a|--all]}} {{path/to/file}}
Convert only leading sequences of blanks (overrides -a):
unexpand --first-only {{path/to/file}}
Have tabs a certain number of characters apart, not 8 (enables -a):
unexpand {{[-t|--tabs]}} {{number}} {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.