Annotation of src/usr.bin/expand/expand.1, Revision 1.19
1.19 ! jmc 1: .\" $OpenBSD: expand.1,v 1.18 2011/12/28 01:52:33 schwarze 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.19 ! jmc 33: .Dd $Mdocdate: December 28 2011 $
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: By default, only leading blanks and tabs
66: are reconverted to maximal strings of tabs.
67: If the
68: .Fl a
69: option is given, tabs are inserted whenever they would compress the
70: resultant file by replacing two or more characters.
71: .It Fl t Ar tablist
1.10 jmc 72: If the argument to
73: .Fl t ,
74: .Ar tablist ,
75: consists of a single numerical argument, tabs are set
76: .Ar tablist
1.1 deraadt 77: spaces apart instead of the default 8.
1.10 jmc 78: If multiple
79: .Fl t
80: options are given, then the tabs are set at those
1.1 deraadt 81: specific columns.
1.9 jmc 82: .Pp
1.10 jmc 83: Otherwise the argument to
84: .Fl t
85: may consist of a list
86: of two or more positive decimal integers,
1.19 ! jmc 87: separated by commas or single blank characters,
1.10 jmc 88: in ascending order:
89: in the event of having to process a
1.9 jmc 90: .Aq tab
1.10 jmc 91: at a position beyond the last of those specified in a multiple
92: .Fl t
93: list,
1.9 jmc 94: the
95: .Aq tab
96: is replaced by a single
97: .Aq space
98: character.
1.1 deraadt 99: .Pp
1.10 jmc 100: This implementation of
101: .Nm
102: additionally allows
103: .Ar tablist
104: to be specified without using the
105: .Fl t
106: flag, by prefixing
107: .Ar tablist
108: with a dash
109: .Pq - .
1.1 deraadt 110: .El
1.16 jmc 111: .Sh EXIT STATUS
1.19 ! jmc 112: .Ex -std expand unexpand
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.14 jmc 121: .St -p1003.1-2008
1.19 ! jmc 122: specification.
! 123: .Pp
! 124: The
! 125: .St -p1003.1-2008
! 126: specification mandates that
1.9 jmc 127: .Nm unexpand
1.19 ! jmc 128: supports the
1.9 jmc 129: .Fl t
1.19 ! jmc 130: flag, but that is not supported by this implementation.
! 131: .Pp
! 132: The ability to specify tabstops without the
! 133: .Fl t
! 134: flag is not specified by
! 135: .St -p1003.1-2008 ,
! 136: though it states it
! 137: .Dq may be present in some implementations .
1.1 deraadt 138: .Sh HISTORY
139: The
1.7 aaron 140: .Nm expand
1.18 schwarze 141: utility first appeared in
142: .Bx 1 .