xref: /freebsd/usr.bin/fold/fold.1 (revision eb69d1f144a6fcc765d1b9d44a5ae8082353e70b)
1.\" Copyright (c) 1980, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"	@(#)fold.1	8.1 (Berkeley) 6/6/93
29.\" $FreeBSD$
30.\"
31.Dd June 6, 2015
32.Dt FOLD 1
33.Os
34.Sh NAME
35.Nm fold
36.Nd "fold long lines for finite width output device"
37.Sh SYNOPSIS
38.Nm
39.Op Fl bs
40.Op Fl w Ar width
41.Op Ar
42.Sh DESCRIPTION
43The
44.Nm
45utility is a filter which folds the contents of the specified files,
46or the standard input if no files are specified,
47breaking the lines to have a maximum of 80 columns.
48.Pp
49The options are as follows:
50.Bl -tag -width indent
51.It Fl b
52Count
53.Ar width
54in bytes rather than column positions.
55.It Fl s
56Fold line after the last blank character within the first
57.Ar width
58column positions (or bytes).
59.It Fl w Ar width
60Specify a line width to use instead of the default 80 columns.
61The
62.Ar width
63value
64should be a multiple of 8 if tabs are present, or the tabs should
65be expanded using
66.Xr expand 1
67before using
68.Nm .
69.El
70.Sh ENVIRONMENT
71The
72.Ev LANG , LC_ALL
73and
74.Ev LC_CTYPE
75environment variables affect the execution of
76.Nm
77as described in
78.Xr environ 7 .
79.Sh SEE ALSO
80.Xr expand 1 ,
81.Xr fmt 1
82.Sh STANDARDS
83The
84.Nm
85utility conforms to
86.St -p1003.1-2001 .
87.Sh HISTORY
88The
89.Nm
90utility first appeared in
91.Bx 1 .
92It was rewritten for
93.Bx 4.3 Reno
94to improve speed and modernize style.
95The
96.Fl b
97and
98.Fl s
99options were added to
100.Nx 1.0
101for
102.St -p1003.2
103compliance.
104.Sh AUTHORS
105.An -nosplit
106.An Bill Joy
107wrote the original version of
108.Nm
109on June 28, 1977.
110.An Kevin Ruddy
111rewrote the command in 1990, and
112.An J. T. Conklin
113added the missing options in 1993.
114.Sh BUGS
115If underlining (see
116.Xr ul 1 )
117is present it may be messed up by folding.
118