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
12 expand - convert tabs to spaces
13
15 expand [-t tablist][file ...]
16
18 The expand utility shall write files or the standard input to the stan‐
19 dard output with <tab>s replaced with one or more <space>s needed to
20 pad to the next tab stop. Any <backspace>s shall be copied to the out‐
21 put and cause the column position count for tab stop calculations to be
22 decremented; the column position count shall not be decremented below
23 zero.
24
26 The expand utility shall conform to the Base Definitions volume of
27 IEEE Std 1003.1-2001, 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, tabs
35 shall be set that number of column positions apart instead of
36 the default 8.
37
38 If a list of tabstops is given, the application shall ensure that it
39 consists of a list of two or more positive decimal integers, separated
40 by <blank>s or commas, in ascending order. The tabs shall be set at
41 those specific column positions. Each tab stop N shall be an integer
42 value greater than zero, and the list is in strictly ascending order.
43 This is taken to mean that, from the start of a line of output, tabbing
44 to position N shall cause the next character output to be in the (
45 N+1)th column position on that line.
46
47 In the event of expand having to process a <tab> at a position beyond
48 the last of those specified in a multiple tab-stop list, the <tab>
49 shall be replaced by a single <space> in the output.
50
51
53 The following operand shall be supported:
54
55 file The pathname of a text file to be used as input.
56
57
59 See the INPUT FILES section.
60
62 Input files shall be text files.
63
65 The following environment variables shall affect the execution of
66 expand:
67
68 LANG Provide a default value for the internationalization variables
69 that are unset or null. (See the Base Definitions volume of
70 IEEE Std 1003.1-2001, Section 8.2, Internationalization Vari‐
71 ables for the precedence of internationalization variables used
72 to determine the values of locale categories.)
73
74 LC_ALL If set to a non-empty string value, override the values of all
75 the other internationalization variables.
76
77 LC_CTYPE
78 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 files),
81 the processing of <tab>s and <space>s, and for the determination
82 of the width in column positions each character would occupy on
83 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 error.
88
89 NLSPATH
90 Determine the location of message catalogs for the processing of
91 LC_MESSAGES .
92
93
95 Default.
96
98 The standard output shall be equivalent to the input files with <tab>s
99 converted into the appropriate number of <space>s.
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
117
119 The expand utility shall terminate with an error message and non-zero
120 exit status upon encountering difficulties accessing one of the file
121 operands.
122
123 The following sections are informative.
124
126 None.
127
129 None.
130
132 The expand utility is useful for preprocessing text files (before sort‐
133 ing, looking at specific columns, and so on) that contain <tab>s.
134
135 See the Base Definitions volume of IEEE Std 1003.1-2001, Section 3.103,
136 Column 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 commas or
141 <blank>s.
142
144 None.
145
147 tabs, unexpand
148
150 Portions of this text are reprinted and reproduced in electronic form
151 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
152 -- Portable Operating System Interface (POSIX), The Open Group Base
153 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
154 Electrical and Electronics Engineers, Inc and The Open Group. In the
155 event of any discrepancy between this version and the original IEEE and
156 The Open Group Standard, the original IEEE and The Open Group Standard
157 is the referee document. The original Standard can be obtained online
158 at http://www.opengroup.org/unix/online.html .
159
160
161
162IEEE/The Open Group 2003 EXPAND(1P)