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
  54 
  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
  59 
  60 .LP
  61 .nf
  62 \fBunexpand\fR [\fB-a\fR] [\fB-t\fR \fItablist\fR] [\fIfile\fR]...
  63 .fi
  64 
  65 .SH DESCRIPTION
  66 .sp
  67 .LP
  68 The \fBexpand\fR utility copies \fIfile\fRs (or the standard input) to the
  69 standard output, with TAB characters expanded to SPACE characters. BACKSPACE
  70 characters are preserved into the output and decrement the column count for TAB
  71 calculations. \fBexpand\fR is useful for pre-processing character files (before
  72 sorting, looking at specific columns, and so forth) that contain TAB
  73 characters.
  74 .sp
  75 .LP
  76 \fBunexpand\fR copies \fIfile\fRs (or the standard input) to the standard
  77 output, putting TAB characters back into the data. By default, only leading
  78 SPACE and TAB characters are converted to strings of tabs, but this can be
  79 overridden by the \fB-a\fR option (see the OPTIONS section below).
  80 .SH OPTIONS
  81 .sp
  82 .LP
  83 The following options are supported for \fBexpand\fR:
  84 .sp
  85 .ne 2
  86 .na
  87 \fB\fB-t\fR \fItablist\fR \fR
  88 .ad
  89 .RS 26n
  90 Specifies the tab stops. The argument \fItablist\fR must consist of a single
  91 positive decimal integer or multiple positive decimal integers, separated by
  92 blank characters or commas, in ascending order. If a single number is given,
  93 tabs will be set \fItablist\fR column positions apart instead of the default
  94 \fB8\fR. If multiple numbers are given, the tabs will be set at those specific
  95 column positions.
  96 .sp
  97 Each tab-stop position \fIN\fR must be an integer value greater than zero, and
  98 the list must be in strictly ascending order. This is taken to mean that, from
  99 the start of a line of output, tabbing to position \fIN\fR causes the next
 100 character output to be in the (\fIN\fR+1)th column position on that line.
 101 .sp
 102 In the event of \fBexpand\fR having to process a tab character at a position
 103 beyond the last of those specified in a multiple tab-stop list, the tab
 104 character is replaced by a single space character in the output.
 105 .RE
 106 
 107 .sp
 108 .ne 2
 109 .na
 110 \fB\fB-\fR\fItabstop\fR \fR
 111 .ad
 112 .RS 26n
 113 Specifies as a single argument, sets TAB characters \fItabstop\fR SPACE
 114 characters apart instead of the default \fB8\fR.
 115 .RE
 116 
 117 .sp
 118 .ne 2
 119 .na
 120 \fB\fB-\fR\fItab1\fR\fI,\|tab2,...,tabn\fR \fR
 121 .ad
 122 .RS 26n
 123 Sets TAB characters at the columns specified by
 124 \fB-\fR\fItab1,tab2,...,\|tabn\fR
 125 .RE
 126 
 127 .sp
 128 .LP
 129 The following options are supported for \fBunexpand\fR:
 130 .sp
 131 .ne 2
 132 .na
 133 \fB\fB-a\fR \fR
 134 .ad
 135 .RS 15n
 136 Inserts TAB characters when replacing a run of two or more SPACE characters
 137 would produce a smaller output file.
 138 .RE
 139 
 140 .sp
 141 .ne 2
 142 .na
 143 \fB\fB-t\fR \fItablist\fR \fR
 144 .ad
 145 .RS 15n
 146 Specifies the tab stops. The option-argument \fItablist\fR must be a single
 147 argument consisting of a single positive decimal integer or multiple positive
 148 decimal integers, separated by blank characters or commas, in ascending order.
 149 If a single number is given, tabs will be set \fItablist\fR column positions
 150 apart instead of the default \fB8\fR. If multiple numbers are given, the tabs
 151 will be set at those specific column positions. Each tab-stop position \fIN\fR
 152 must be an integer value greater than zero, and the list must be in strictly
 153 ascending order. This is taken to mean that, from the start of a line of
 154 output, tabbing to position \fIN\fR will cause the next character output to be
 155 in the (\fIN\fR+1)th column position on that line. When the \fB-t\fR option is
 156 not specified, the default is the equivalent of specifying \fB-t\fR \fB8\fR
 157 (except for the interaction with \fB-a\fR, described below).
 158 .sp
 159 No space-to-tab character conversions occur for characters at positions beyond
 160 the last of those specified in a multiple tab-stop list.
 161 .sp
 162 When \fB-t\fR is specified, the presence or absence of the \fB-a\fR option is
 163 ignored; conversion will not be limited to the processing of leading blank
 164 characters.
 165 .RE
 166 
 167 .SH OPERANDS
 168 .sp
 169 .LP
 170 The following ooperand is supported for \fBexpand\fR and \fBunexpand\fR:
 171 .sp
 172 .ne 2
 173 .na
 174 \fB\fB\fIfile\fR\fR \fR
 175 .ad
 176 .RS 9n
 177 The path name of a text file to be used as input.
 178 .RE
 179 
 180 .SH ENVIRONMENT VARIABLES
 181 .sp
 182 .LP
 183 See \fBenviron\fR(5) for descriptions of the following environment variables
 184 that affect the execution of \fBexpand\fR and \fBunexpand\fR: \fBLANG\fR,
 185 \fBLC_ALL\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
 186 .SH EXIT STATUS
 187 .sp
 188 .LP
 189 The following exit values are returned:
 190 .sp
 191 .ne 2
 192 .na
 193 \fB\fB0\fR \fR
 194 .ad
 195 .RS 7n
 196 Successful completion
 197 .RE
 198 
 199 .sp
 200 .ne 2
 201 .na
 202 \fB\fB>0\fR \fR
 203 .ad
 204 .RS 7n
 205 An error occurred.
 206 .RE
 207 
 208 .SH ATTRIBUTES
 209 .sp
 210 .LP
 211 See \fBattributes\fR(5) for descriptions of the following attributes:
 212 .sp
 213 
 214 .sp
 215 .TS
 216 box;
 217 c | c
 218 l | l .
 219 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 220 _
 221 CSI     enabled
 222 _
 223 Interface Stability     Standard
 224 .TE
 225 
 226 .SH SEE ALSO
 227 .sp
 228 .LP
 229 \fBtabs\fR(1), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)