1*04daaba9Sjmc.\" $OpenBSD: expand.1,v 1.20 2014/03/17 21:48:51 jmc Exp $ 2df930be7Sderaadt.\" $NetBSD: expand.1,v 1.3 1995/09/02 06:19:45 jtc Exp $ 3df930be7Sderaadt.\" 4df930be7Sderaadt.\" Copyright (c) 1980, 1990, 1993 5df930be7Sderaadt.\" The Regents of the University of California. All rights reserved. 6df930be7Sderaadt.\" 7df930be7Sderaadt.\" Redistribution and use in source and binary forms, with or without 8df930be7Sderaadt.\" modification, are permitted provided that the following conditions 9df930be7Sderaadt.\" are met: 10df930be7Sderaadt.\" 1. Redistributions of source code must retain the above copyright 11df930be7Sderaadt.\" notice, this list of conditions and the following disclaimer. 12df930be7Sderaadt.\" 2. Redistributions in binary form must reproduce the above copyright 13df930be7Sderaadt.\" notice, this list of conditions and the following disclaimer in the 14df930be7Sderaadt.\" documentation and/or other materials provided with the distribution. 15f75387cbSmillert.\" 3. Neither the name of the University nor the names of its contributors 16df930be7Sderaadt.\" may be used to endorse or promote products derived from this software 17df930be7Sderaadt.\" without specific prior written permission. 18df930be7Sderaadt.\" 19df930be7Sderaadt.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20df930be7Sderaadt.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21df930be7Sderaadt.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22df930be7Sderaadt.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23df930be7Sderaadt.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24df930be7Sderaadt.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25df930be7Sderaadt.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26df930be7Sderaadt.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27df930be7Sderaadt.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28df930be7Sderaadt.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29df930be7Sderaadt.\" SUCH DAMAGE. 30df930be7Sderaadt.\" 31df930be7Sderaadt.\" @(#)expand.1 8.1 (Berkeley) 6/9/93 32df930be7Sderaadt.\" 33*04daaba9Sjmc.Dd $Mdocdate: March 17 2014 $ 34df930be7Sderaadt.Dt EXPAND 1 352e0eb34fSaaron.Os 36df930be7Sderaadt.Sh NAME 37df930be7Sderaadt.Nm expand , 38df930be7Sderaadt.Nm unexpand 39df930be7Sderaadt.Nd expand tabs to spaces, and vice versa 40df930be7Sderaadt.Sh SYNOPSIS 41df930be7Sderaadt.Nm expand 4215bea365Sjmc.Op Fl t Ar tablist 4315bea365Sjmc.Op Ar 44df930be7Sderaadt.Nm unexpand 45df930be7Sderaadt.Op Fl a 4615bea365Sjmc.Op Ar 47df930be7Sderaadt.Sh DESCRIPTION 48453cecf0Saaron.Nm expand 49c59bcd0aSjmcprocesses the named files or the standard input, 50c59bcd0aSjmcwriting the standard output with tabs changed into blanks. 51df930be7SderaadtBackspace characters are preserved into the output and decrement 52df930be7Sderaadtthe column count for tab calculations. 53453cecf0Saaron.Nm expand 54df930be7Sderaadtis useful for pre-processing character files 55df930be7Sderaadt(before sorting, looking at specific columns, etc.) that 56df930be7Sderaadtcontain tabs. 57df930be7Sderaadt.Pp 58cd6b8de1Sjmc.Nm unexpand 59cd6b8de1Sjmcputs tabs back into the data from the standard input or the named 60cd6b8de1Sjmcfiles and writes the result on the standard output. 61cd6b8de1Sjmc.Pp 62cd6b8de1SjmcThe options are as follows: 63cd6b8de1Sjmc.Bl -tag -width flag 64cd6b8de1Sjmc.It Fl a 65cd6b8de1SjmcBy default, only leading blanks and tabs 66cd6b8de1Sjmcare reconverted to maximal strings of tabs. 67cd6b8de1SjmcIf the 68cd6b8de1Sjmc.Fl a 69cd6b8de1Sjmcoption is given, tabs are inserted whenever they would compress the 70cd6b8de1Sjmcresultant file by replacing two or more characters. 71cd6b8de1Sjmc.It Fl t Ar tablist 7215bea365SjmcIf the argument to 7315bea365Sjmc.Fl t , 7415bea365Sjmc.Ar tablist , 7515bea365Sjmcconsists of a single numerical argument, tabs are set 7615bea365Sjmc.Ar tablist 77df930be7Sderaadtspaces apart instead of the default 8. 7815bea365SjmcIf multiple 7915bea365Sjmc.Fl t 8015bea365Sjmcoptions are given, then the tabs are set at those 81df930be7Sderaadtspecific columns. 82c59bcd0aSjmc.Pp 8315bea365SjmcOtherwise the argument to 8415bea365Sjmc.Fl t 8515bea365Sjmcmay consist of a list 8615bea365Sjmcof two or more positive decimal integers, 87d9ff45abSjmcseparated by commas or single blank characters, 8815bea365Sjmcin ascending order: 8915bea365Sjmcin the event of having to process a 90c59bcd0aSjmc.Aq tab 9115bea365Sjmcat a position beyond the last of those specified in a multiple 9215bea365Sjmc.Fl t 9315bea365Sjmclist, 94c59bcd0aSjmcthe 95c59bcd0aSjmc.Aq tab 96c59bcd0aSjmcis replaced by a single 97c59bcd0aSjmc.Aq space 98c59bcd0aSjmccharacter. 99df930be7Sderaadt.Pp 10015bea365SjmcThis implementation of 10115bea365Sjmc.Nm 10215bea365Sjmcadditionally allows 10315bea365Sjmc.Ar tablist 10415bea365Sjmcto be specified without using the 10515bea365Sjmc.Fl t 10615bea365Sjmcflag, by prefixing 10715bea365Sjmc.Ar tablist 10815bea365Sjmcwith a dash 10915bea365Sjmc.Pq - . 110df930be7Sderaadt.El 111f1c64ac4Sjmc.Sh EXIT STATUS 112d9ff45abSjmc.Ex -std expand unexpand 113453cecf0Saaron.Sh SEE ALSO 114453cecf0Saaron.Xr fold 1 115c59bcd0aSjmc.Sh STANDARDS 116c59bcd0aSjmcThe 117c59bcd0aSjmc.Nm 118c59bcd0aSjmcand 119c59bcd0aSjmc.Nm unexpand 120c59bcd0aSjmcutilities are compliant with the 12199332e38Sjmc.St -p1003.1-2008 122*04daaba9Sjmcspecification, 123*04daaba9Sjmcexcept that this implementation does not support a 124c59bcd0aSjmc.Fl t 125*04daaba9Sjmcflag for 126*04daaba9Sjmc.Nm unexpand . 127d9ff45abSjmc.Pp 128d9ff45abSjmcThe ability to specify tabstops without the 129d9ff45abSjmc.Fl t 130d9ff45abSjmcflag is not specified by 131d9ff45abSjmc.St -p1003.1-2008 , 132d9ff45abSjmcthough it states it 133d9ff45abSjmc.Dq may be present in some implementations . 134df930be7Sderaadt.Sh HISTORY 135df930be7SderaadtThe 136453cecf0Saaron.Nm expand 137aa662f97Sschwarzeutility first appeared in 138aa662f97Sschwarze.Bx 1 . 139