xref: /freebsd/usr.bin/fold/fold.1 (revision bdcbfde31e8e9b343f113a1956384bdf30d1ed62)
19b50d902SRodney W. Grimes.\" Copyright (c) 1980, 1993
29b50d902SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
39b50d902SRodney W. Grimes.\"
49b50d902SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
59b50d902SRodney W. Grimes.\" modification, are permitted provided that the following conditions
69b50d902SRodney W. Grimes.\" are met:
79b50d902SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
89b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
99b50d902SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
109b50d902SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
119b50d902SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
12fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors
139b50d902SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
149b50d902SRodney W. Grimes.\"    without specific prior written permission.
159b50d902SRodney W. Grimes.\"
169b50d902SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
179b50d902SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
189b50d902SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
199b50d902SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
209b50d902SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
219b50d902SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
229b50d902SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
239b50d902SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
249b50d902SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
259b50d902SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
269b50d902SRodney W. Grimes.\" SUCH DAMAGE.
279b50d902SRodney W. Grimes.\"
28*b139a8faSFernando Apesteguía.Dd October 29, 2020
299b50d902SRodney W. Grimes.Dt FOLD 1
309b50d902SRodney W. Grimes.Os
319b50d902SRodney W. Grimes.Sh NAME
329b50d902SRodney W. Grimes.Nm fold
339b50d902SRodney W. Grimes.Nd "fold long lines for finite width output device"
349b50d902SRodney W. Grimes.Sh SYNOPSIS
358fe908efSRuslan Ermilov.Nm
3613e06695STim J. Robbins.Op Fl bs
379b50d902SRodney W. Grimes.Op Fl w Ar width
381fec918bSDima Dorfman.Op Ar
399b50d902SRodney W. Grimes.Sh DESCRIPTION
403898680cSPhilippe CharnierThe
413898680cSPhilippe Charnier.Nm
423898680cSPhilippe Charnierutility is a filter which folds the contents of the specified files,
439b50d902SRodney W. Grimesor the standard input if no files are specified,
44b887806dSTim J. Robbinsbreaking the lines to have a maximum of 80 columns.
459b50d902SRodney W. Grimes.Pp
46816dde7dSTim J. RobbinsThe options are as follows:
479b50d902SRodney W. Grimes.Bl -tag -width indent
4813e06695STim J. Robbins.It Fl b
4913e06695STim J. RobbinsCount
5013e06695STim J. Robbins.Ar width
5113e06695STim J. Robbinsin bytes rather than column positions.
5213e06695STim J. Robbins.It Fl s
5313e06695STim J. RobbinsFold line after the last blank character within the first
5413e06695STim J. Robbins.Ar width
5513e06695STim J. Robbinscolumn positions (or bytes).
56a9c9a0d1SPhilippe Charnier.It Fl w Ar width
57b887806dSTim J. RobbinsSpecify a line width to use instead of the default 80 columns.
5876682b26SRuslan ErmilovThe
5976682b26SRuslan Ermilov.Ar width
6076682b26SRuslan Ermilovvalue
619b50d902SRodney W. Grimesshould be a multiple of 8 if tabs are present, or the tabs should
629b50d902SRodney W. Grimesbe expanded using
639b50d902SRodney W. Grimes.Xr expand 1
649b50d902SRodney W. Grimesbefore using
658fe908efSRuslan Ermilov.Nm .
669b50d902SRodney W. Grimes.El
67f9dd3a8bSTim J. Robbins.Sh ENVIRONMENT
68f9dd3a8bSTim J. RobbinsThe
69f9dd3a8bSTim J. Robbins.Ev LANG , LC_ALL
70f9dd3a8bSTim J. Robbinsand
71f9dd3a8bSTim J. Robbins.Ev LC_CTYPE
72f9dd3a8bSTim J. Robbinsenvironment variables affect the execution of
73f9dd3a8bSTim J. Robbins.Nm
74f9dd3a8bSTim J. Robbinsas described in
75f9dd3a8bSTim J. Robbins.Xr environ 7 .
76*b139a8faSFernando Apesteguía.Sh EXAMPLES
77*b139a8faSFernando ApesteguíaFold text in standard input with a width of 20 columns:
78*b139a8faSFernando Apesteguía.Bd -literal -offset indent
79*b139a8faSFernando Apesteguía$ echo "I am smart enough to know that I am dumb" | fold -w 15
80*b139a8faSFernando ApesteguíaI am smart enou
81*b139a8faSFernando Apesteguíagh to know that
82*b139a8faSFernando Apesteguía I am dumb
83*b139a8faSFernando Apesteguía.Ed
84*b139a8faSFernando Apesteguía.Pp
85*b139a8faSFernando ApesteguíaSame as above but breaking lines after the last blank character:
86*b139a8faSFernando Apesteguía.Bd -literal -offset indent
87*b139a8faSFernando Apesteguía$ echo "I am smart enough to know that I am dumb" | fold -s -w 15
88*b139a8faSFernando ApesteguíaI am smart
89*b139a8faSFernando Apesteguíaenough to know
90*b139a8faSFernando Apesteguíathat I am dumb
91*b139a8faSFernando Apesteguía.Ed
929b50d902SRodney W. Grimes.Sh SEE ALSO
93f9dd3a8bSTim J. Robbins.Xr expand 1 ,
94f9dd3a8bSTim J. Robbins.Xr fmt 1
9513e06695STim J. Robbins.Sh STANDARDS
9613e06695STim J. RobbinsThe
9713e06695STim J. Robbins.Nm
9813e06695STim J. Robbinsutility conforms to
9913e06695STim J. Robbins.St -p1003.1-2001 .
100cf58cb8dSBaptiste Daroussin.Sh HISTORY
101cf58cb8dSBaptiste DaroussinThe
102cf58cb8dSBaptiste Daroussin.Nm
103cf58cb8dSBaptiste Daroussinutility first appeared in
104cf58cb8dSBaptiste Daroussin.Bx 1 .
105cf58cb8dSBaptiste DaroussinIt was rewritten for
106cf58cb8dSBaptiste Daroussin.Bx 4.3 Reno
107cf58cb8dSBaptiste Daroussinto improve speed and modernize style.
108cf58cb8dSBaptiste DaroussinThe
109cf58cb8dSBaptiste Daroussin.Fl b
110cf58cb8dSBaptiste Daroussinand
111cf58cb8dSBaptiste Daroussin.Fl s
112cf58cb8dSBaptiste Daroussinoptions were added to
113cf58cb8dSBaptiste Daroussin.Nx 1.0
114cf58cb8dSBaptiste Daroussinfor
115cf58cb8dSBaptiste Daroussin.St -p1003.2
116cf58cb8dSBaptiste Daroussincompliance.
117cf58cb8dSBaptiste Daroussin.Sh AUTHORS
118cf58cb8dSBaptiste Daroussin.An -nosplit
119cf58cb8dSBaptiste Daroussin.An Bill Joy
120cf58cb8dSBaptiste Daroussinwrote the original version of
121cf58cb8dSBaptiste Daroussin.Nm
122cf58cb8dSBaptiste Daroussinon June 28, 1977.
123cf58cb8dSBaptiste Daroussin.An Kevin Ruddy
124cf58cb8dSBaptiste Daroussinrewrote the command in 1990, and
125cf58cb8dSBaptiste Daroussin.An J. T. Conklin
126cf58cb8dSBaptiste Daroussinadded the missing options in 1993.
1279b50d902SRodney W. Grimes.Sh BUGS
12876682b26SRuslan ErmilovIf underlining (see
12976682b26SRuslan Ermilov.Xr ul 1 )
13076682b26SRuslan Ermilovis present it may be messed up by folding.
131