Annotation of src/usr.bin/expand/expand.1, Revision 1.11
1.11 ! jmc 1: .\" $OpenBSD: expand.1,v 1.10 2006/10/16 15:45:09 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: .\"
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
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.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
1.10 jmc 121: .St -p1003.1-2004
1.9 jmc 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
1.10 jmc 128: flag.
1.9 jmc 129: .It
130: .Tn POSIX
131: specifies that multiple tabstops may be given separated by
132: commas or blanks.
133: This implementation supports only comma-separated tabstops.
134: .It
135: .Nm unexpand
136: does not recognise the
137: .Fl t
138: flag.
139: .El
1.1 deraadt 140: .Sh HISTORY
141: The
1.7 aaron 142: .Nm expand
1.1 deraadt 143: command appeared in
144: .Bx 3.0 .