Annotation of src/usr.bin/expand/expand.1, Revision 1.9
1.9 ! jmc 1: .\" $OpenBSD: expand.1,v 1.8 2003/06/03 02:56:07 millert Exp $
1.1 deraadt 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.
1.8 millert 15: .\" 3. Neither the name of the University nor the names of its contributors
1.1 deraadt 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 June 9, 1993
34: .Dt EXPAND 1
1.5 aaron 35: .Os
1.1 deraadt 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 Ns Ar tabstop
1.9 ! jmc 43: .Oo Xo
! 44: .Sm off
! 45: .Fl Ar tab1 , tab2 ,
! 46: .Ar ... , Ar tabn
! 47: .Sm on
! 48: .Oc
! 49: .Xc
! 50: .Op Ar file Ar ...
! 51: .Nm expand
! 52: .Op Fl t Ar tabstop
! 53: .Oo Xo
! 54: .Sm off
! 55: .Fl t\ \& Ar tab1 , tab2 ,
! 56: .Ar ... , Ar tabn
! 57: .Sm on
! 58: .Oc
! 59: .Xc
1.4 deraadt 60: .Op Ar file Ar ...
1.1 deraadt 61: .Nm unexpand
62: .Op Fl a
1.4 deraadt 63: .Op Ar file Ar ...
1.1 deraadt 64: .Sh DESCRIPTION
1.7 aaron 65: .Nm expand
1.9 ! jmc 66: processes the named files or the standard input,
! 67: writing the standard output with tabs changed into blanks.
1.1 deraadt 68: Backspace characters are preserved into the output and decrement
69: the column count for tab calculations.
1.7 aaron 70: .Nm expand
1.1 deraadt 71: is useful for pre-processing character files
72: (before sorting, looking at specific columns, etc.) that
73: contain tabs.
74: .Pp
75: If a single
76: .Ar tabstop
1.3 aaron 77: argument is given, tabs are set
1.1 deraadt 78: .Ar tabstop
79: spaces apart instead of the default 8.
1.9 ! jmc 80: If multiple tabstops are given, then the tabs are set at those
1.1 deraadt 81: specific columns.
1.9 ! jmc 82: In the synopsis above, both forms of the
! 83: .Nm
! 84: command are identical.
! 85: .Pp
! 86: If a list of tabstops is given, it should consist of a list
! 87: of two or more positive decimal integers, in ascending order.
! 88: In the event of having to process a
! 89: .Aq tab
! 90: at a position beyond the last of those specified in a multiple tabstop list,
! 91: the
! 92: .Aq tab
! 93: is replaced by a single
! 94: .Aq space
! 95: character.
1.1 deraadt 96: .Pp
1.3 aaron 97: .Nm unexpand
1.1 deraadt 98: puts tabs back into the data from the standard input or the named
99: files and writes the result on the standard output.
100: .Pp
1.7 aaron 101: The options (for
1.1 deraadt 102: .Nm unexpand
1.7 aaron 103: only) are as follows:
1.1 deraadt 104: .Bl -tag -width flag
105: .It Fl a
106: By default, only leading blanks and tabs
1.7 aaron 107: are reconverted to maximal strings of tabs.
108: If the
1.1 deraadt 109: .Fl a
1.3 aaron 110: option is given, tabs are inserted whenever they would compress the
1.1 deraadt 111: resultant file by replacing two or more characters.
112: .El
1.7 aaron 113: .Sh SEE ALSO
114: .Xr fold 1
1.9 ! jmc 115: .Sh STANDARDS
! 116: The
! 117: .Nm
! 118: and
! 119: .Nm unexpand
! 120: utilities are compliant with the
! 121: .St -p1003.1
! 122: specification, with the following exceptions:
! 123: .Bl -bullet -offset indent
! 124: .It
! 125: .Tn POSIX
! 126: does not support specifying tabstops without use of the
! 127: .Fl t
! 128: flag (first form in
! 129: .Sx SYNOPSIS
! 130: above).
! 131: .It
! 132: .Tn POSIX
! 133: specifies that multiple tabstops may be given separated by
! 134: commas or blanks.
! 135: This implementation supports only comma-separated tabstops.
! 136: .It
! 137: .Nm unexpand
! 138: does not recognise the
! 139: .Fl t
! 140: flag.
! 141: .El
1.1 deraadt 142: .Sh HISTORY
143: The
1.7 aaron 144: .Nm expand
1.1 deraadt 145: command appeared in
146: .Bx 3.0 .