Annotation of src/usr.bin/expand/expand.1, Revision 1.18
1.18 ! schwarze 1: .\" $OpenBSD: expand.1,v 1.17 2010/11/07 08:05:56 jmc 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: .\"
1.18 ! schwarze 33: .Dd $Mdocdate: November 7 2010 $
1.1 deraadt 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
1.10 jmc 42: .Op Fl t Ar tablist
43: .Op Ar
1.1 deraadt 44: .Nm unexpand
45: .Op Fl a
1.10 jmc 46: .Op Ar
1.1 deraadt 47: .Sh DESCRIPTION
1.7 aaron 48: .Nm expand
1.9 jmc 49: processes the named files or the standard input,
50: writing the standard output with tabs changed into blanks.
1.1 deraadt 51: Backspace characters are preserved into the output and decrement
52: the column count for tab calculations.
1.7 aaron 53: .Nm expand
1.1 deraadt 54: is useful for pre-processing character files
55: (before sorting, looking at specific columns, etc.) that
56: contain tabs.
57: .Pp
1.11 jmc 58: .Nm unexpand
59: puts tabs back into the data from the standard input or the named
60: files and writes the result on the standard output.
61: .Pp
62: The options are as follows:
63: .Bl -tag -width flag
64: .It Fl a
65: .Pq Nm unexpand No only
66: By default, only leading blanks and tabs
67: are reconverted to maximal strings of tabs.
68: If the
69: .Fl a
70: option is given, tabs are inserted whenever they would compress the
71: resultant file by replacing two or more characters.
72: .It Fl t Ar tablist
73: .Pq Nm expand No only
1.10 jmc 74: If the argument to
75: .Fl t ,
76: .Ar tablist ,
77: consists of a single numerical argument, tabs are set
78: .Ar tablist
1.1 deraadt 79: spaces apart instead of the default 8.
1.10 jmc 80: If multiple
81: .Fl t
82: options are given, then the tabs are set at those
1.1 deraadt 83: specific columns.
1.9 jmc 84: .Pp
1.10 jmc 85: Otherwise the argument to
86: .Fl t
87: may consist of a list
88: of two or more positive decimal integers,
89: comma separated,
90: in ascending order:
91: in the event of having to process a
1.9 jmc 92: .Aq tab
1.10 jmc 93: at a position beyond the last of those specified in a multiple
94: .Fl t
95: list,
1.9 jmc 96: the
97: .Aq tab
98: is replaced by a single
99: .Aq space
100: character.
1.1 deraadt 101: .Pp
1.10 jmc 102: This implementation of
103: .Nm
104: additionally allows
105: .Ar tablist
106: to be specified without using the
107: .Fl t
108: flag, by prefixing
109: .Ar tablist
110: with a dash
111: .Pq - .
1.1 deraadt 112: .El
1.16 jmc 113: .Sh EXIT STATUS
1.17 jmc 114: The
115: .Nm expand
116: and
117: .Nm unexpand
118: utilities exit 0 on success or \*(Gt0 if an error occurred.
1.7 aaron 119: .Sh SEE ALSO
120: .Xr fold 1
1.9 jmc 121: .Sh STANDARDS
122: The
123: .Nm
124: and
125: .Nm unexpand
126: utilities are compliant with the
1.14 jmc 127: .St -p1003.1-2008
1.12 jmc 128: specification,
129: with the following exceptions:
1.9 jmc 130: .Bl -bullet -offset indent
131: .It
132: .Tn POSIX
133: does not support specifying tabstops without use of the
134: .Fl t
1.10 jmc 135: flag.
1.9 jmc 136: .It
137: .Tn POSIX
138: specifies that multiple tabstops may be given separated by
139: commas or blanks.
140: This implementation supports only comma-separated tabstops.
141: .It
142: .Nm unexpand
143: does not recognise the
144: .Fl t
145: flag.
146: .El
1.1 deraadt 147: .Sh HISTORY
148: The
1.7 aaron 149: .Nm expand
1.18 ! schwarze 150: utility first appeared in
! 151: .Bx 1 .