xref: /openbsd/usr.bin/split/split.1 (revision 610f49f8)
1.\"	$OpenBSD: split.1,v 1.8 2002/01/24 20:33:46 mickey Exp $
2.\"	$NetBSD: split.1,v 1.5 1994/12/21 08:20:35 jtc Exp $
3.\"
4.\" Copyright (c) 1990, 1991, 1993, 1994
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.
15.\" 3. All advertising materials mentioning features or use of this software
16.\"    must display the following acknowledgement:
17.\"	This product includes software developed by the University of
18.\"	California, Berkeley and its contributors.
19.\" 4. Neither the name of the University nor the names of its contributors
20.\"    may be used to endorse or promote products derived from this software
21.\"    without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.\"	@(#)split.1	8.3 (Berkeley) 4/16/94
36.\"
37.Dd April 16, 1994
38.Dt SPLIT 1
39.Os
40.Sh NAME
41.Nm split
42.Nd split a file into pieces
43.Sh SYNOPSIS
44.Nm split
45.Op Fl b Ar byte_count[k|m]
46.Op Fl l Ar line_count
47.Op Fl p Ar pattern
48.Op Ar file Op Ar name
49.Sh DESCRIPTION
50The
51.Nm
52utility reads the given
53.Ar file
54(or standard input if no file is specified)
55and breaks it up into files of 1000 lines each.
56.Pp
57The options are as follows:
58.Bl -tag -width Ds
59.It Fl b
60Create smaller files
61.Ar byte_count
62bytes in length.
63If
64.Sq k
65is appended to the number, the file is split into
66.Ar byte_count
67kilobyte pieces.
68If
69.Sq m
70is appended to the number, the file is split into
71.Ar byte_count
72megabyte pieces.
73.It Fl l
74Create smaller files
75.Ar n
76lines in length.
77.It Fl p Ar pattern
78The file is split whenever an input line matches
79.Ar pattern ,
80which is interpreted as an extended regular expression.
81The matching line will be the first line of the next output file.
82This option is incompatible with the
83.Fl b
84and
85.Fl l
86options.
87.El
88.Pp
89If additional arguments are specified, the first is used as the name
90of the input file which is to be split.
91If a second additional argument is specified, it is used as a prefix
92for the names of the files into which the file is split.
93In this case, each file into which the file is split is named by the
94prefix followed by a lexically ordered suffix in the range of
95.Dq aa-zz .
96.Pp
97If the
98.Ar name
99argument is not specified, the file is split into lexically ordered
100files named in the range of
101.Dq xaa-zzz .
102.Sh SEE ALSO
103.Xr re_format 7
104.Sh HISTORY
105A
106.Nm
107command appeared in
108.At v3 .
109.Sh BUGS
110For historical reasons, if you specify
111.Ar name ,
112.Nm
113can only create 676 separate
114files.
115The default naming convention allows 2028 separate files.
116.Pp
117The maximum line length for matching patterns is 65536.
118