unexpand(1) unexpand(1)
NAME
unexpand - convert spaces to tabs
SYNOPSIS
/usr/ucb/unexpand[ -a| -t tablist][ file]...
DESCRIPTION
The unexpand commands writes files or the standard input to the stan-
dard output, with blanks at the beginning of each line converted to
the maximum number of tabs, followed by the minimum number of blanks
needed to pad the line to the next tab stop, which were originally
filled by the converted characters. A tab stop is set after every 8
column positions by default. All backspace characters are copied to
the output and cause the column position count for for tab stop calcu-
lations to be decremented. The column position count will not be
decremented below zero.
OPTIONS
-a Not only are the blanks at the start of each line converted, but
also all sequences of two or more blanks directly in front of a
tab stop are converted into the maximum number of tabs followed
by the minimum number of blanks needed to pad the line to the
next tab stop, which were originally filled by the converted
characters.
-t tablist
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 posi-
tions. 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 posi-
tion N causes the next character output to be in the (N+1)th
column position in that line.
For characters that are one position behind the last position
defined in a list with multiple tab stops, there is no conversion
of blanks into tabs.
If -t is specified, conversion of blanks is not restricted to the
leading blanks. -a is ignored in this case.
file The file whose blanks are to be replaced by tab characters.
Page 1 Reliant UNIX 5.44 Printed 11/98
unexpand(1) unexpand(1)
ENVIRONMENT VARIABLES
The following environment variables affect the execution of unexpand:
LANG Specifies a default value for the internationalization
variables that are unset or null. If LANG is unset or
null, the corresponding default value from the interna-
tionalized environment is used. If one of the interna-
tionalization variables contains an invalid setting, the
command behaves as if none of the variables have been
defined.
LCALL If this variable has been assigned a value, i.e. it is
not a null string, this value overrides the values of all
the other internationalization variables.
LCCTYPE Determines the internationalized environment for the
interpretation of byte sequences (e.g. single-byte char-
acters as opposed to multi-byte characters in arguments
and input files). The internationalized environment for
the processing of tab characters and blanks and for the
specification of the width in column positions each char-
acter would occupy on a constant-width output device.
LCMESSAGES Determines the format and contents of error messages.
NLSPATH Determines the position of message catalogs for the pro-
cessing of LCMESSAGES.
STANDARD OUTPUT (STDOUT)
The standard output is equivalent to the input files with blanks con-
verted into the appropriate number of tabs.
APPLICATION USAGE
The default behavior of unexpand, whereby only leading blanks are
taken into consideration, may not be desired in some cases. Users who
always want to convert all blanks in a file should use an alias defin-
ition [see ksh(1)] to create a version of unexpand that is always
called with the options -a or -t 8.
EXIT STATUS
0 Successful completion.
>0 An error occurred.
SEE ALSO
expand(1), ksh(1), tabs(1).
Page 2 Reliant UNIX 5.44 Printed 11/98