expand(1)

expand(1)

NAME

expand, unexpand - expand tabs to spaces, and vice versa

SYNOPSIS

expand [-ttablist ] [ ®le ... ]

unexpand [-a][-t tablist ] [ ®le ... ]

Obsolescent:

expand [-tabstop ] [-tab1,tab2,...,tabn ] [ ®le ... ]

DESCRIPTION

expand processes the named ®les or the standard input and writes to the standard output with tabs changed into spaces. Backspace characters are preserved in the output, and the column count is decreased by one column for tab calculations. For proper tab calculation, if a multi-column character is to be "backspace'd", it should be followed by multiple backspace characters which equal to it's column width. If a tab character is found after the last tab position, it is replaced by a single space. expand is useful for preprocessing character ®les that contain tabs (before sorting, looking at speci®c columns, etc).

expand recognizes the following command-line options and arguments:

[-ttablist ] tablist speci®es where to set the tab positions instead of the default 8. tablist can take two forms. If it is a single number, tabs are set tablist spaces apart. tablist can also be a blank- or comma-separated list of increasing positions where tabs are to be set.

[-tabstop ]

This option is obsolescent and is equivalent to using -ttabstop.

[-tab1,tab2,...,tabn ]

This option is obsolescent and is equivalent to using -ttab1,tab2, ... ,tabn.

unexpand processes the named ®les or the standard input and writes to the standard output with spaces changed into tabs where possible. By default, only leading spaces and tabs are converted to maximal strings of tabs. The default tab position is every 8 characters. Backspace characters are preserved into the output, and the column count is decreased by one column for tab calculations. For proper tab calculation, if a multi-column character is to be "backspace'd", it should be followed by multiple backspace characters which equal to it's column width.

unexpand recognizes the following command-line options and arguments:

-a

Tabs are inserted whenever they would compress the resultant ®le by replacing two or

 

more spaces before a tab position.

-ttablist

tablist speci®es the tab positions. tablist can take two forms. If it is a single number,

 

tabs are set every tablist spaces apart. If tablist is a blank- or comma-separated list of

 

increasing positions, tabs are set at those locations. The -toption implies the -a

 

option. If the -toption is not speci®ed, the default is equivalent to specifying -t 8

 

except that -ais not implied for this case.

EXTERNAL INFLUENCES

Environment Variables

LC_CTYPE determines the interpretation of text as single and/or multi-byte characters.

LC_MESSAGES determines the language in which messages are displayed.

If LC_CTYPE or LC_MESSAGES is not speci®ed in the environment or is set to the empty string, the value of LANG is used as a default for each unspeci®ed or empty variable. If LANG is not speci®ed or is set to the empty string, a default of "C" (see lang(5)) is used instead of LANG.

If any internationalization variable contains an invalid setting, expand and unexpand behave as if all internationalization variables are set to "C". See environ(5).

If LC_ALL is set to a non-empty string value, it overrides the values of all the other internationalization variables.

International Code Set Support

Single- and multi-byte character code sets are supported with the exception that unexpand do not recognize multi-byte alternative space characters.

HP-UX Release 11i: December 2000

− 1 −

Section 1259

e