1EXPAND(1P)                 POSIX Programmer's Manual                EXPAND(1P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       expand — convert tabs to spaces
13

SYNOPSIS

15       expand [-t tablist] [file...]
16

DESCRIPTION

18       The expand utility shall write files or the standard input to the stan‐
19       dard  output  with  <tab>  characters replaced with one or more <space>
20       characters needed to pad to the next tab stop. Any <backspace>  charac‐
21       ters  shall be copied to the output and cause the column position count
22       for tab stop calculations to be decremented; the column position  count
23       shall not be decremented below zero.
24

OPTIONS

26       The  expand  utility  shall  conform  to the Base Definitions volume of
27       POSIX.1‐2017, Section 12.2, Utility Syntax Guidelines.
28
29       The following option shall be supported:
30
31       -t tablist
32                 Specify the tab stops. The application shall ensure that  the
33                 argument tablist consists of either a single positive decimal
34                 integer or a list of tabstops. If a single number  is  given,
35                 tabs  shall  be  set  that  number  of column positions apart
36                 instead of the default 8.
37
38                 If a list of tabstops is given, the application shall  ensure
39                 that  it  consists  of a list of two or more positive decimal
40                 integers, separated by  <blank>  or  <comma>  characters,  in
41                 ascending  order.  The <tab> characters shall be set at those
42                 specific column positions. Each tab stop N shall be an  inte‐
43                 ger  value  greater  than  zero,  and the list is in strictly
44                 ascending order. This is taken to mean that, from  the  start
45                 of  a  line  of output, tabbing to position N shall cause the
46                 next character output to be in the (N+1)th column position on
47                 that line.
48
49                 In  the  event of expand having to process a <tab> at a posi‐
50                 tion beyond the last of those specified in  a  multiple  tab-
51                 stop list, the <tab> shall be replaced by a single <space> in
52                 the output.
53

OPERANDS

55       The following operand shall be supported:
56
57       file      The pathname of a text file to be used as input.
58

STDIN

60       See the INPUT FILES section.
61

INPUT FILES

63       Input files shall be text files.
64

ENVIRONMENT VARIABLES

66       The following environment  variables  shall  affect  the  execution  of
67       expand:
68
69       LANG      Provide  a  default  value for the internationalization vari‐
70                 ables that are unset or null. (See the Base Definitions  vol‐
71                 ume  of POSIX.1‐2017, Section 8.2, Internationalization Vari‐
72                 ables for the precedence  of  internationalization  variables
73                 used to determine the values of locale categories.)
74
75       LC_ALL    If  set  to  a non-empty string value, override the values of
76                 all the other internationalization variables.
77
78       LC_CTYPE  Determine the locale for the interpretation of  sequences  of
79                 bytes of text data as characters (for example, single-byte as
80                 opposed to  multi-byte  characters  in  arguments  and  input
81                 files),  the  processing of <tab> and <space> characters, and
82                 for the determination of the width in column  positions  each
83                 character would occupy on an output device.
84
85       LC_MESSAGES
86                 Determine the locale that should be used to affect the format
87                 and contents  of  diagnostic  messages  written  to  standard
88                 error.
89
90       NLSPATH   Determine the location of message catalogs for the processing
91                 of LC_MESSAGES.
92

ASYNCHRONOUS EVENTS

94       Default.
95

STDOUT

97       The standard output shall be equivalent to the input files  with  <tab>
98       characters converted into the appropriate number of <space> characters.
99

STDERR

101       The standard error shall be used only for diagnostic messages.
102

OUTPUT FILES

104       None.
105

EXTENDED DESCRIPTION

107       None.
108

EXIT STATUS

110       The following exit values shall be returned:
111
112        0    Successful completion
113
114       >0    An error occurred.
115

CONSEQUENCES OF ERRORS

117       The  expand  utility shall terminate with an error message and non-zero
118       exit status upon encountering difficulties accessing one  of  the  file
119       operands.
120
121       The following sections are informative.
122

APPLICATION USAGE

124       None.
125

EXAMPLES

127       None.
128

RATIONALE

130       The expand utility is useful for preprocessing text files (before sort‐
131       ing, looking at specific columns, and so on) that contain <tab> charac‐
132       ters.
133
134       See  the Base Definitions volume of POSIX.1‐2017, Section 3.103, Column
135       Position.
136
137       The tablist option-argument consists of integers  in  ascending  order.
138       Utility  Syntax Guideline 8 mandates that expand shall accept the inte‐
139       gers (within the single argument) separated  using  either  <comma>  or
140       <blank> characters.
141
142       Earlier  versions  of  this  standard allowed the following form in the
143       SYNOPSIS:
144
145
146           expand [-tabstop][-tab1,tab2,...,tabn][file ...]
147
148       This form is no longer specified by POSIX.1‐2008 but may be present  in
149       some implementations.
150

FUTURE DIRECTIONS

152       None.
153

SEE ALSO

155       tabs, unexpand
156
157       The  Base  Definitions  volume  of  POSIX.1‐2017, Section 3.103, Column
158       Position, Chapter 8, Environment Variables, Section 12.2, Utility  Syn‐
159       tax Guidelines
160
162       Portions  of  this text are reprinted and reproduced in electronic form
163       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
164       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
165       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
166       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
167       event of any discrepancy between this version and the original IEEE and
168       The  Open Group Standard, the original IEEE and The Open Group Standard
169       is the referee document. The original Standard can be  obtained  online
170       at http://www.opengroup.org/unix/online.html .
171
172       Any  typographical  or  formatting  errors that appear in this page are
173       most likely to have been introduced during the conversion of the source
174       files  to  man page format. To report such errors, see https://www.ker
175       nel.org/doc/man-pages/reporting_bugs.html .
176
177
178
179IEEE/The Open Group                  2017                           EXPAND(1P)
Impressum