1.\" $OpenBSD: expand.1,v 1.14 2009/02/08 17:15:09 jmc Exp $ 2.\" $NetBSD: expand.1,v 1.3 1995/09/02 06:19:45 jtc Exp $ 3.\" 4.\" Copyright (c) 1980, 1990, 1993 5.\" The Regents of the University of California. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 3. Neither the name of the University nor the names of its contributors 16.\" may be used to endorse or promote products derived from this software 17.\" without specific prior written permission. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" SUCH DAMAGE. 30.\" 31.\" @(#)expand.1 8.1 (Berkeley) 6/9/93 32.\" 33.Dd $Mdocdate: February 8 2009 $ 34.Dt EXPAND 1 35.Os 36.Sh NAME 37.Nm expand , 38.Nm unexpand 39.Nd expand tabs to spaces, and vice versa 40.Sh SYNOPSIS 41.Nm expand 42.Op Fl t Ar tablist 43.Op Ar 44.Nm unexpand 45.Op Fl a 46.Op Ar 47.Sh DESCRIPTION 48.Nm expand 49processes the named files or the standard input, 50writing the standard output with tabs changed into blanks. 51Backspace characters are preserved into the output and decrement 52the column count for tab calculations. 53.Nm expand 54is useful for pre-processing character files 55(before sorting, looking at specific columns, etc.) that 56contain tabs. 57.Pp 58.Nm unexpand 59puts tabs back into the data from the standard input or the named 60files and writes the result on the standard output. 61.Pp 62The options are as follows: 63.Bl -tag -width flag 64.It Fl a 65.Pq Nm unexpand No only 66By default, only leading blanks and tabs 67are reconverted to maximal strings of tabs. 68If the 69.Fl a 70option is given, tabs are inserted whenever they would compress the 71resultant file by replacing two or more characters. 72.It Fl t Ar tablist 73.Pq Nm expand No only 74If the argument to 75.Fl t , 76.Ar tablist , 77consists of a single numerical argument, tabs are set 78.Ar tablist 79spaces apart instead of the default 8. 80If multiple 81.Fl t 82options are given, then the tabs are set at those 83specific columns. 84.Pp 85Otherwise the argument to 86.Fl t 87may consist of a list 88of two or more positive decimal integers, 89comma separated, 90in ascending order: 91in the event of having to process a 92.Aq tab 93at a position beyond the last of those specified in a multiple 94.Fl t 95list, 96the 97.Aq tab 98is replaced by a single 99.Aq space 100character. 101.Pp 102This implementation of 103.Nm 104additionally allows 105.Ar tablist 106to be specified without using the 107.Fl t 108flag, by prefixing 109.Ar tablist 110with a dash 111.Pq - . 112.El 113.Sh SEE ALSO 114.Xr fold 1 115.Sh STANDARDS 116The 117.Nm 118and 119.Nm unexpand 120utilities are compliant with the 121.St -p1003.1-2008 122specification, 123with the following exceptions: 124.Bl -bullet -offset indent 125.It 126.Tn POSIX 127does not support specifying tabstops without use of the 128.Fl t 129flag. 130.It 131.Tn POSIX 132specifies that multiple tabstops may be given separated by 133commas or blanks. 134This implementation supports only comma-separated tabstops. 135.It 136.Nm unexpand 137does not recognise the 138.Fl t 139flag. 140.El 141.Sh HISTORY 142The 143.Nm expand 144command appeared in 145.Bx 3.0 . 146