Options for unexpand command
- -a, – -all option : This option is used to convert all blanks, instead of just initial blanks (which is by default).
/* This converts all the blanks also into tabs */ $unexpand -a kt.txt>dv.txt
- – -first-only option : This is used to convert only leading sequences of blanks (overrides -a option).
/* This converts only the leading sequences of blanks */ $unexpand --first-only kt.txt>dv.txt
- -t, – -tabs=N option : This set tabs N characters apart instead of the default of 8 (enables -a option).
/* the -t option with numerical value 2 forces to change the spaces into tabs of only 2 characters */ $unexpand -t2 kt.txt>dv.txt
- -t, – -tabs=LIST option : This option uses comma separated LIST of tab positions (enables -a option).
- – -help option : This display a help message and exit.
- – -version option : This display version information and exit.
Also see : expand command
unexpand command in Linux with Examples
To convert the leading spaces and tabs into tabs, there exists a command line utility called unexpand command.
The unexpand command by default convert each spaces into tabs writing the produced output to the standard output. Here’s the syntax of unexpand command :
Syntax :
$unexpand [OPTION]... [FILE]...
where, OPTION refers to the options compatible with unexpand and FILE refers to the file name.