1EXPAND(1P) POSIX Programmer's Manual EXPAND(1P)
2
3
4
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
11
13 expand — convert tabs to spaces
14
16 expand [−t tablist] [file...]
17
19 The expand utility shall write files or the standard input to the stan‐
20 dard output with <tab> characters replaced with one or more <space>
21 characters needed to pad to the next tab stop. Any <backspace> charac‐
22 ters shall be copied to the output and cause the column position count
23 for tab stop calculations to be decremented; the column position count
24 shall not be decremented below zero.
25
27 The expand utility shall conform to the Base Definitions volume of
28 POSIX.1‐2008, Section 12.2, Utility Syntax Guidelines.
29
30 The following option shall be supported:
31
32 −t tablist
33 Specify the tab stops. The application shall ensure that the
34 argument tablist consists of either a single positive decimal
35 integer or a list of tabstops. If a single number is given,
36 tabs shall be set that number of column positions apart
37 instead of the default 8.
38
39 If a list of tabstops is given, the application shall ensure
40 that it consists of a list of two or more positive decimal
41 integers, separated by <blank> or <comma> characters, in
42 ascending order. The <tab> characters shall be set at those
43 specific column positions. Each tab stop N shall be an inte‐
44 ger value greater than zero, and the list is in strictly
45 ascending order. This is taken to mean that, from the start
46 of a line of output, tabbing to position N shall cause the
47 next character output to be in the (N+1)th column position on
48 that line.
49
50 In the event of expand having to process a <tab> at a posi‐
51 tion beyond the last of those specified in a multiple tab-
52 stop list, the <tab> shall be replaced by a single <space> in
53 the output.
54
56 The following operand shall be supported:
57
58 file The pathname of a text file to be used as input.
59
61 See the INPUT FILES section.
62
64 Input files shall be text files.
65
67 The following environment variables shall affect the execution of
68 expand:
69
70 LANG Provide a default value for the internationalization vari‐
71 ables that are unset or null. (See the Base Definitions vol‐
72 ume of POSIX.1‐2008, Section 8.2, Internationalization Vari‐
73 ables for the precedence of internationalization variables
74 used to determine the values of locale categories.)
75
76 LC_ALL If set to a non-empty string value, override the values of
77 all the other internationalization variables.
78
79 LC_CTYPE Determine the locale for the interpretation of sequences of
80 bytes of text data as characters (for example, single-byte as
81 opposed to multi-byte characters in arguments and input
82 files), the processing of <tab> and <space> characters, and
83 for the determination of the width in column positions each
84 character would occupy on an output device.
85
86 LC_MESSAGES
87 Determine the locale that should be used to affect the format
88 and contents of diagnostic messages written to standard
89 error.
90
91 NLSPATH Determine the location of message catalogs for the processing
92 of LC_MESSAGES.
93
95 Default.
96
98 The standard output shall be equivalent to the input files with <tab>
99 characters converted into the appropriate number of <space> characters.
100
102 The standard error shall be used only for diagnostic messages.
103
105 None.
106
108 None.
109
111 The following exit values shall be returned:
112
113 0 Successful completion
114
115 >0 An error occurred.
116
118 The expand utility shall terminate with an error message and non-zero
119 exit status upon encountering difficulties accessing one of the file
120 operands.
121
122 The following sections are informative.
123
125 None.
126
128 None.
129
131 The expand utility is useful for preprocessing text files (before sort‐
132 ing, looking at specific columns, and so on) that contain <tab> charac‐
133 ters.
134
135 See the Base Definitions volume of POSIX.1‐2008, Section 3.103, Column
136 Position.
137
138 The tablist option-argument consists of integers in ascending order.
139 Utility Syntax Guideline 8 mandates that expand shall accept the inte‐
140 gers (within the single argument) separated using either <comma> or
141 <blank> characters.
142
143 Earlier versions of this standard allowed the following form in the
144 SYNOPSIS:
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
152 None.
153
155 tabs, unexpand
156
157 The Base Definitions volume of POSIX.1‐2008, 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, 2013 Edition, Standard for Information Technology
164 -- Portable Operating System Interface (POSIX), The Open Group Base
165 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
166 cal and Electronics Engineers, Inc and The Open Group. (This is
167 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
168 event of any discrepancy between this version and the original IEEE and
169 The Open Group Standard, the original IEEE and The Open Group Standard
170 is the referee document. The original Standard can be obtained online
171 at http://www.unix.org/online.html .
172
173 Any typographical or formatting errors that appear in this page are
174 most likely to have been introduced during the conversion of the source
175 files to man page format. To report such errors, see https://www.ker‐
176 nel.org/doc/man-pages/reporting_bugs.html .
177
178
179
180IEEE/The Open Group 2013 EXPAND(1P)