Move everything from /var/adm to /var/log
[unleashed.git] / share / man / man1 / expand.1
blob0bc209a522c50b9a3ebb98070281406f3d6ee8f0
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
44 .\" Portions Copyright (c) 1995, Sun Microsystems, Inc.  All Rights Reserved.
45 .\"
46 .TH EXPAND 1 "Feb 1, 1995"
47 .SH NAME
48 expand, unexpand \- expand TAB characters to SPACE characters, and vice versa
49 .SH SYNOPSIS
50 .LP
51 .nf
52 \fBexpand\fR [\fB-t\fR \fItablist\fR] [\fIfile\fR]...
53 .fi
55 .LP
56 .nf
57 \fBexpand\fR [\fB-\fItabstop\fR\fR] [\fB-\fItab1,\fR\fR \fItab2,.\fR \fI\&.\fR \fI\&.,\fR \fItabn\fR] [\fIfile\fR]...
58 .fi
60 .LP
61 .nf
62 \fBunexpand\fR [\fB-a\fR] [\fB-t\fR \fItablist\fR] [\fIfile\fR]...
63 .fi
65 .SH DESCRIPTION
66 .LP
67 The \fBexpand\fR utility copies \fIfile\fRs (or the standard input) to the
68 standard output, with TAB characters expanded to SPACE characters. BACKSPACE
69 characters are preserved into the output and decrement the column count for TAB
70 calculations. \fBexpand\fR is useful for pre-processing character files (before
71 sorting, looking at specific columns, and so forth) that contain TAB
72 characters.
73 .sp
74 .LP
75 \fBunexpand\fR copies \fIfile\fRs (or the standard input) to the standard
76 output, putting TAB characters back into the data. By default, only leading
77 SPACE and TAB characters are converted to strings of tabs, but this can be
78 overridden by the \fB-a\fR option (see the OPTIONS section below).
79 .SH OPTIONS
80 .LP
81 The following options are supported for \fBexpand\fR:
82 .sp
83 .ne 2
84 .na
85 \fB\fB-t\fR \fItablist\fR \fR
86 .ad
87 .RS 26n
88 Specifies the tab stops. The argument \fItablist\fR must consist of a single
89 positive decimal integer or multiple positive decimal integers, separated by
90 blank characters or commas, in ascending order. If a single number is given,
91 tabs will be set \fItablist\fR column positions apart instead of the default
92 \fB8\fR. If multiple numbers are given, the tabs will be set at those specific
93 column positions.
94 .sp
95 Each tab-stop position \fIN\fR must be an integer value greater than zero, and
96 the list must be in strictly ascending order. This is taken to mean that, from
97 the start of a line of output, tabbing to position \fIN\fR causes the next
98 character output to be in the (\fIN\fR+1)th column position on that line.
99 .sp
100 In the event of \fBexpand\fR having to process a tab character at a position
101 beyond the last of those specified in a multiple tab-stop list, the tab
102 character is replaced by a single space character in the output.
106 .ne 2
108 \fB\fB-\fR\fItabstop\fR \fR
110 .RS 26n
111 Specifies as a single argument, sets TAB characters \fItabstop\fR SPACE
112 characters apart instead of the default \fB8\fR.
116 .ne 2
118 \fB\fB-\fR\fItab1\fR\fI,\|tab2,...,tabn\fR \fR
120 .RS 26n
121 Sets TAB characters at the columns specified by
122 \fB-\fR\fItab1,tab2,...,\|tabn\fR
127 The following options are supported for \fBunexpand\fR:
129 .ne 2
131 \fB\fB-a\fR \fR
133 .RS 15n
134 Inserts TAB characters when replacing a run of two or more SPACE characters
135 would produce a smaller output file.
139 .ne 2
141 \fB\fB-t\fR \fItablist\fR \fR
143 .RS 15n
144 Specifies the tab stops. The option-argument \fItablist\fR must be a single
145 argument consisting of a single positive decimal integer or multiple positive
146 decimal integers, separated by blank characters or commas, in ascending order.
147 If a single number is given, tabs will be set \fItablist\fR column positions
148 apart instead of the default \fB8\fR. If multiple numbers are given, the tabs
149 will be set at those specific column positions. Each tab-stop position \fIN\fR
150 must be an integer value greater than zero, and the list must be in strictly
151 ascending order. This is taken to mean that, from the start of a line of
152 output, tabbing to position \fIN\fR will cause the next character output to be
153 in the (\fIN\fR+1)th column position on that line. When the \fB-t\fR option is
154 not specified, the default is the equivalent of specifying \fB-t\fR \fB8\fR
155 (except for the interaction with \fB-a\fR, described below).
157 No space-to-tab character conversions occur for characters at positions beyond
158 the last of those specified in a multiple tab-stop list.
160 When \fB-t\fR is specified, the presence or absence of the \fB-a\fR option is
161 ignored; conversion will not be limited to the processing of leading blank
162 characters.
165 .SH OPERANDS
167 The following operand is supported for \fBexpand\fR and \fBunexpand\fR:
169 .ne 2
171 \fB\fB\fIfile\fR\fR \fR
173 .RS 9n
174 The path name of a text file to be used as input.
177 .SH ENVIRONMENT VARIABLES
179 See \fBenviron\fR(5) for descriptions of the following environment variables
180 that affect the execution of \fBexpand\fR and \fBunexpand\fR: \fBLANG\fR,
181 \fBLC_ALL\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
182 .SH EXIT STATUS
184 The following exit values are returned:
186 .ne 2
188 \fB\fB0\fR \fR
190 .RS 7n
191 Successful completion
195 .ne 2
197 \fB\fB>0\fR \fR
199 .RS 7n
200 An error occurred.
203 .SH ATTRIBUTES
205 See \fBattributes\fR(5) for descriptions of the following attributes:
210 box;
211 c | c
212 l | l .
213 ATTRIBUTE TYPE  ATTRIBUTE VALUE
215 CSI     enabled
217 Interface Stability     Standard
220 .SH SEE ALSO
222 \fBtabs\fR(1), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)