1EXPAND(P) POSIX Programmer's Manual EXPAND(P)
2
3
4
6 expand - convert tabs to spaces
7
9 expand [-t tablist][file ...]
10
12 The expand utility shall write files or the standard input to the stan‐
13 dard output with <tab>s replaced with one or more <space>s needed to
14 pad to the next tab stop. Any <backspace>s shall be copied to the out‐
15 put and cause the column position count for tab stop calculations to be
16 decremented; the column position count shall not be decremented below
17 zero.
18
20 The expand utility shall conform to the Base Definitions volume of
21 IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
22
23 The following option shall be supported:
24
25 -t tablist
26 Specify the tab stops. The application shall ensure that the
27 argument tablist consists of either a single positive decimal
28 integer or a list of tabstops. If a single number is given, tabs
29 shall be set that number of column positions apart instead of
30 the default 8.
31
32 If a list of tabstops is given, the application shall ensure that it
33 consists of a list of two or more positive decimal integers, separated
34 by <blank>s or commas, in ascending order. The tabs shall be set at
35 those specific column positions. Each tab stop N shall be an integer
36 value greater than zero, and the list is in strictly ascending order.
37 This is taken to mean that, from the start of a line of output, tabbing
38 to position N shall cause the next character output to be in the (
39 N+1)th column position on that line.
40
41 In the event of expand having to process a <tab> at a position beyond
42 the last of those specified in a multiple tab-stop list, the <tab>
43 shall be replaced by a single <space> in the output.
44
45
47 The following operand shall be supported:
48
49 file The pathname of a text file to be used as input.
50
51
53 See the INPUT FILES section.
54
56 Input files shall be text files.
57
59 The following environment variables shall affect the execution of
60 expand:
61
62 LANG Provide a default value for the internationalization variables
63 that are unset or null. (See the Base Definitions volume of
64 IEEE Std 1003.1-2001, Section 8.2, Internationalization Vari‐
65 ables for the precedence of internationalization variables used
66 to determine the values of locale categories.)
67
68 LC_ALL If set to a non-empty string value, override the values of all
69 the other internationalization variables.
70
71 LC_CTYPE
72 Determine the locale for the interpretation of sequences of
73 bytes of text data as characters (for example, single-byte as
74 opposed to multi-byte characters in arguments and input files),
75 the processing of <tab>s and <space>s, and for the determination
76 of the width in column positions each character would occupy on
77 an output device.
78
79 LC_MESSAGES
80 Determine the locale that should be used to affect the format
81 and contents of diagnostic messages written to standard error.
82
83 NLSPATH
84 Determine the location of message catalogs for the processing of
85 LC_MESSAGES .
86
87
89 Default.
90
92 The standard output shall be equivalent to the input files with <tab>s
93 converted into the appropriate number of <space>s.
94
96 The standard error shall be used only for diagnostic messages.
97
99 None.
100
102 None.
103
105 The following exit values shall be returned:
106
107 0 Successful completion
108
109 >0 An error occurred.
110
111
113 The expand utility shall terminate with an error message and non-zero
114 exit status upon encountering difficulties accessing one of the file
115 operands.
116
117 The following sections are informative.
118
120 None.
121
123 None.
124
126 The expand utility is useful for preprocessing text files (before sort‐
127 ing, looking at specific columns, and so on) that contain <tab>s.
128
129 See the Base Definitions volume of IEEE Std 1003.1-2001, Section 3.103,
130 Column Position.
131
132 The tablist option-argument consists of integers in ascending order.
133 Utility Syntax Guideline 8 mandates that expand shall accept the inte‐
134 gers (within the single argument) separated using either commas or
135 <blank>s.
136
138 None.
139
141 tabs , unexpand
142
144 Portions of this text are reprinted and reproduced in electronic form
145 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
146 -- Portable Operating System Interface (POSIX), The Open Group Base
147 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
148 Electrical and Electronics Engineers, Inc and The Open Group. In the
149 event of any discrepancy between this version and the original IEEE and
150 The Open Group Standard, the original IEEE and The Open Group Standard
151 is the referee document. The original Standard can be obtained online
152 at http://www.opengroup.org/unix/online.html .
153
154
155
156IEEE/The Open Group 2003 EXPAND(P)