Linux unexpand command: convert space characters to tabs.
Linux unexpand command Function Description
Use the unexpand command to convert the space characters in each specified file to tabs and write them to the standard output.
The unexpand command is used to convert blank characters (space) in a given file to tabs (TAB) and display the result of the conversion on a standard output device (display terminal).
Linux unexpand command Syntax
unexpand [Option] [File]
Options:
- The meaning of each option in the command is shown in the table below:
Option | Description |
---|---|
-a |
Convert all space characters not just the first letter of the alphabet |
--first-only |
Convert starting spaces only (override -a option) |
-t <List> |
List tab positions using a comma-separated list (with the -a option enabled) |
-t <Width> |
Set the tab width instead of the default 8 (enable the -a option) |
File
- Specify the list of files to be converted from blank to TAB.
Linux unexpand command Example
Convert space characters in /root/apidemos.com.txt file to tabs
unexpand /root/apidemos.com.txt
Output:
Convert the space characters in the /root/install.log file to tabs with a tab width of 4
[root@rhel ~]# unexpand -t 4 /root/install.log