xref: /netbsd-src/usr.bin/split/split.1 (revision 23c8222edbfb0f0932d88a8351d3a0cf817dfb9e)
1.\"	$NetBSD: split.1,v 1.13 2003/08/07 11:15:55 agc Exp $
2.\"
3.\" Copyright (c) 1990, 1991, 1993, 1994
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\"	@(#)split.1	8.3 (Berkeley) 4/16/94
31.\"
32.Dd July 10, 2003
33.Dt SPLIT 1
34.Os
35.Sh NAME
36.Nm split
37.Nd split a file into pieces
38.Sh SYNOPSIS
39.Nm
40.Op Fl a Ar suffix_length
41.Oo
42.Fl b Ar byte_count Ns Oo Li k|m Oc |
43.Fl l Ar line_count
44.Oc
45.Op Ar file Op Ar name
46.Sh DESCRIPTION
47The
48.Nm
49utility reads the given
50.Ar file
51and breaks it up into files of 1000 lines each.
52If
53.Ar file
54is a single dash or absent,
55.Nm
56reads from the standard input.
57.Pp
58The options are as follows:
59.Bl -tag -width Ds
60.It Fl a
61Use
62.Ar suffix_length
63letters to form the suffix of the file name.
64.It Fl b
65Create smaller files
66.Ar byte_count
67bytes in length.
68If
69.Ql k
70is appended to the number, the file is split into
71.Ar byte_count
72kilobyte pieces.
73If
74.Ql m
75is appended to the number, the file is split into
76.Ar byte_count
77megabyte pieces.
78.It Fl l
79Create smaller files
80.Ar line_count
81lines in length.
82.El
83.Pp
84If additional arguments are specified, the first is used as the name
85of the input file which is to be split.
86If a second additional argument is specified, it is used as a prefix
87for the names of the files into which the file is split.
88In this case, each file into which the file is split is named by the
89prefix followed by a lexically ordered suffix using
90.Ar suffix_length
91characters in the range
92.Dq Li a-z .
93If
94.Fl a
95is not specified, two letters are used as the suffix.
96.Pp
97If the
98.Ar name
99argument is not specified,
100.Ql x
101is used.
102.Sh STANDARDS
103The
104.Nm
105utility conforms to
106.St -p1003.1-2001 .
107.Sh HISTORY
108A
109.Nm
110command appeared in
111.At v6 .
112.Pp
113The
114.Fl a
115option was introduced in
116.Nx 2.0 .
117Before that, if
118.Ar name
119was not specified,
120.Nm
121would vary the first letter of the filename
122to increase the number of possible output files.
123The
124.Fl a
125option makes this unnecessary.
126