.\" .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for .\" permission to reproduce portions of its copyrighted documentation. .\" Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. .\" .\" The Institute of Electrical and Electronics Engineers and The Open .\" Group, have given us permission to reprint portions of their .\" documentation. .\" .\" In the following statement, the phrase ``this text'' refers to portions .\" of the system documentation. .\" .\" Portions of this text are reprinted and reproduced in electronic form .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition, .\" Standard for Information Technology -- Portable Operating System .\" Interface (POSIX), The Open Group Base Specifications Issue 6, .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics .\" Engineers, Inc and The Open Group. In the event of any discrepancy .\" between these versions and the original IEEE and The Open Group .\" Standard, the original IEEE and The Open Group Standard is the referee .\" document. The original Standard can be obtained online at .\" http://www.opengroup.org/unix/online.html. .\" .\" This notice shall appear on any product containing this material. .\" .\" The contents of this file are subject to the terms of the .\" Common Development and Distribution License (the "License"). .\" You may not use this file except in compliance with the License. .\" .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE .\" or http://www.opensolaris.org/os/licensing. .\" See the License for the specific language governing permissions .\" and limitations under the License. .\" .\" When distributing Covered Code, include this CDDL HEADER in each .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. .\" If applicable, add the following below this CDDL HEADER, with the .\" fields enclosed by brackets "[]" replaced with your own identifying .\" information: Portions Copyright [yyyy] [name of copyright owner] .\" .\" .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved. .\" Portions Copyright (c) 1995, Sun Microsystems, Inc. All Rights Reserved. .\" .TH EXPAND 1 "Feb 1, 1995" .SH NAME expand, unexpand \- expand TAB characters to SPACE characters, and vice versa .SH SYNOPSIS .LP .nf \fBexpand\fR [\fB-t\fR \fItablist\fR] [\fIfile\fR]... .fi .LP .nf \fBexpand\fR [\fB-\fItabstop\fR\fR] [\fB-\fItab1,\fR\fR \fItab2,.\fR \fI\&.\fR \fI\&.,\fR \fItabn\fR] [\fIfile\fR]... .fi .LP .nf \fBunexpand\fR [\fB-a\fR] [\fB-t\fR \fItablist\fR] [\fIfile\fR]... .fi .SH DESCRIPTION .LP The \fBexpand\fR utility copies \fIfile\fRs (or the standard input) to the standard output, with TAB characters expanded to SPACE characters. BACKSPACE characters are preserved into the output and decrement the column count for TAB calculations. \fBexpand\fR is useful for pre-processing character files (before sorting, looking at specific columns, and so forth) that contain TAB characters. .sp .LP \fBunexpand\fR copies \fIfile\fRs (or the standard input) to the standard output, putting TAB characters back into the data. By default, only leading SPACE and TAB characters are converted to strings of tabs, but this can be overridden by the \fB-a\fR option (see the OPTIONS section below). .SH OPTIONS .LP The following options are supported for \fBexpand\fR: .sp .ne 2 .na \fB\fB-t\fR \fItablist\fR \fR .ad .RS 26n Specifies the tab stops. The argument \fItablist\fR must consist of a single positive decimal integer or multiple positive decimal integers, separated by blank characters or commas, in ascending order. If a single number is given, tabs will be set \fItablist\fR column positions apart instead of the default \fB8\fR. If multiple numbers are given, the tabs will be set at those specific column positions. .sp Each tab-stop position \fIN\fR must be an integer value greater than zero, and the list must be in strictly ascending order. This is taken to mean that, from the start of a line of output, tabbing to position \fIN\fR causes the next character output to be in the (\fIN\fR+1)th column position on that line. .sp In the event of \fBexpand\fR having to process a tab character at a position beyond the last of those specified in a multiple tab-stop list, the tab character is replaced by a single space character in the output. .RE .sp .ne 2 .na \fB\fB-\fR\fItabstop\fR \fR .ad .RS 26n Specifies as a single argument, sets TAB characters \fItabstop\fR SPACE characters apart instead of the default \fB8\fR. .RE .sp .ne 2 .na \fB\fB-\fR\fItab1\fR\fI,\|tab2,...,tabn\fR \fR .ad .RS 26n Sets TAB characters at the columns specified by \fB-\fR\fItab1,tab2,...,\|tabn\fR .RE .sp .LP The following options are supported for \fBunexpand\fR: .sp .ne 2 .na \fB\fB-a\fR \fR .ad .RS 15n Inserts TAB characters when replacing a run of two or more SPACE characters would produce a smaller output file. .RE .sp .ne 2 .na \fB\fB-t\fR \fItablist\fR \fR .ad .RS 15n Specifies the tab stops. The option-argument \fItablist\fR must be a single argument consisting of a single positive decimal integer or multiple positive decimal integers, separated by blank characters or commas, in ascending order. If a single number is given, tabs will be set \fItablist\fR column positions apart instead of the default \fB8\fR. If multiple numbers are given, the tabs will be set at those specific column positions. Each tab-stop position \fIN\fR must be an integer value greater than zero, and the list must be in strictly ascending order. This is taken to mean that, from the start of a line of output, tabbing to position \fIN\fR will cause the next character output to be in the (\fIN\fR+1)th column position on that line. When the \fB-t\fR option is not specified, the default is the equivalent of specifying \fB-t\fR \fB8\fR (except for the interaction with \fB-a\fR, described below). .sp No space-to-tab character conversions occur for characters at positions beyond the last of those specified in a multiple tab-stop list. .sp When \fB-t\fR is specified, the presence or absence of the \fB-a\fR option is ignored; conversion will not be limited to the processing of leading blank characters. .RE .SH OPERANDS .LP The following operand is supported for \fBexpand\fR and \fBunexpand\fR: .sp .ne 2 .na \fB\fB\fIfile\fR\fR \fR .ad .RS 9n The path name of a text file to be used as input. .RE .SH ENVIRONMENT VARIABLES .LP See \fBenviron\fR(5) for descriptions of the following environment variables that affect the execution of \fBexpand\fR and \fBunexpand\fR: \fBLANG\fR, \fBLC_ALL\fR, \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR. .SH EXIT STATUS .LP The following exit values are returned: .sp .ne 2 .na \fB\fB0\fR \fR .ad .RS 7n Successful completion .RE .sp .ne 2 .na \fB\fB>0\fR \fR .ad .RS 7n An error occurred. .RE .SH ATTRIBUTES .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ CSI enabled _ Interface Stability Standard .TE .SH SEE ALSO .LP \fBtabs\fR(1), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)