![Forrest logo](/images/logo.png)
unexpand
Unexpand is a command-line tool that comes pre-installed in most Unix-like operating systems. Its primary function is to convert spaces into tabs in text files. It can be used to adjust the indentation of text, especially when working with programming code or configuration files.
The tool can also be used to convert tabs to spaces, making it useful for consistent formatting of text in various environments. It supports a variety of options to customize its behavior, such as specifying the number of spaces per tab or the use of a particular character for indentation.
Unexpand can process multiple files simultaneously or read input from standard input, making it flexible for different use cases. It also has options to handle special cases like processing files with mixed tabs and spaces, preserving whitespace in certain areas, or converting leading spaces to tabs while preserving spaces within lines.
The command-line tool is simple to use, typically requiring just the input file(s) and the desired options. It processes the text files and outputs the modified version, either on the screen or into a new file, depending on the specified options.
Unexpand is handy when working with text files that need consistent indentation, especially in scenarios where spaces and tabs need to be converted or adjusted. Its ability to process files in bulk and handle various scenarios makes it a powerful tool for text manipulation and formatting.
List of commands for unexpand:
-
unexpand:tldr:25a96 unexpand: Convert only leading sequences of blanks (overrides -a).$ unexpand --first-only ${filename}try on your machineexplain this command
-
unexpand:tldr:2fbdd unexpand: Convert blanks to tabs, reading from standard output.$ unexpandtry on your machineexplain this command
-
unexpand:tldr:59ded unexpand: Have tabs a certain number of characters apart, not 8 (enables -a).$ unexpand -t ${number} ${filename}try on your machineexplain this command
-
unexpand:tldr:a9489 unexpand: Convert blanks in each file to tabs, writing to standard output.$ unexpand ${filename}try on your machineexplain this command
-
unexpand:tldr:c169f unexpand: Convert all blanks, instead of just initial blanks.$ unexpand -a ${filename}try on your machineexplain this command