expand1
Expand tabs to spaces, and vice versa
Usage
expand [-t
tab1,tab2, ...
,tabn]
[file ...]
unexpand [{-a | -t
tab1,tab2, ...
,tabn}]
[file ...]
Overview
The expand utility processes the named files or the standard input writing the standard output with tabs changed into blanks. Backspace characters are preserved into the output and decrement the column count for tab calculations. The expand utility is useful for pre-processing character files (before sorting, looking at specific columns, etc.) that contain tabs.
The unexpand utility puts tabs back into the data from the standard input or the named files and writes the result on the standard output.
The following options are available:
-
-a -
(
unexpandonly.) By default, only leading blanks and tabs are reconverted to maximal strings of tabs. If the-aoption is given, then tabs are inserted whenever they would compress the resultant file by replacing two or more characters. -
-t -
tab1,tab2,...,tabn Set tab stops at column positions tab1,tab2,...,tabn. If only a single number is given, tab stops are set that number of column positions apart instead of the default number of 8.
Environment
The LANG, LC_ALL and LC_CTYPE environment variables affect the execution of expand and unexpand as described in environ(7).
Exit status
The expand and unexpand utilities exit 0 on success, and >0 if an error occurs.
Releases
87 releases since FreeBSD 2.0.5-RELEASE; the text changed 46 times.
- 2.0.5–3.5.1
- 4.0
- 4.1–4.2
- 4.3
- 4.4–4.6.2
- 4.7
- 4.8–4.11
- 5.0–5.2.1
- 5.3–5.5
- 6.0–6.1
- 6.2–6.3
- 6.4
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
- 8.0
- 8.1
- 8.2
- 8.3
- 8.4
- 9.0
- 9.1
- 9.2
- 9.3
- 10.0
- 10.1
- 10.2
- 10.3
- 10.4
- 11.0
- 11.1
- 11.2
- 11.3
- 11.4
- 12.0
- 12.1
- 12.2
- 12.3
- 12.4
- 13.0–13.2
- 13.3
- 13.4–13.5
- 14.0
- 14.1–14.5
- 15.0–16.0
-t since FreeBSD 14.1-RELEASE.