The expand command writes files or the standard input to the standard output with tab characters replaced by one or more blanks needed to pad the line to the next tab stop.
All backspace characters are copied to the output and cause the column position count for tab stop calculations to be decremented. The column position count will not be decremented below zero.
Syntax
Format 1: | expand[ -t tablist][ file...] |
Format 2: | expand[ -tabstop | -tab1,tab2,...,tabn][ file...] |
Specifies the tab stops. The argument tablist must consist of one or more numbers, separated by blanks or commas, in ascending order. A list separated by blanks must be enclosed in quotes. If only one number is specified, the tab stops will be set to tablist column positions instead of the default 8 column positions. If multiple numbers are given, the tabs will be set at the specified column positions. Each tab stop position N must be an integer value greater than zero, and the specifications must be in ascending order. This means that tabbing from the start of the line of output to position N causes the next character output to be in the ( N +1)th column position in that line. If the expand command has to process a tab character at a position beyond the last position specified in a multiple tab stop list, the tab character is replaced by a blank in the output.
The file whose tab characters are to be replaced by blanks.
Specifies the tab stops. A single number is specifed as tabstop with a leading minus;
The file whose tab characters are to be replaced by blanks. |
Standard Output (stdout)
The standard output is equivalent to the input files with tab characters converted into the appropriate number of blanks. |
Locale
The following environment variables affect the execution of expand: LANG Provide a default value for the internationalization variables that are unset or null. If LANG is unset of null, the corresponding value from the implementation-specific default locale will be used. If any of the internationalization variables contains an invalid setting, the utility will behave as if none of the variables had been defined. LC_ALL If set to a non-empty string value, override the values of all the other internationalization variables. LC_CTYPE Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments and input files), the classification of characters as upper- to lower-case, and the mapping of characters from one case to the other. LC_MESSAGES Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error. NLSPATH Determine the location of message catalogs for the processing of LC_MESSAGES. |
See also
tabs, unexpand |