1.\" $NetBSD: split.1,v 1.15 2007/05/31 01:35:35 jschauma 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 May 28, 2007 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.Fl n Ar chunk_count 45.Oc 46.Op Ar file Op Ar name 47.Sh DESCRIPTION 48The 49.Nm 50utility reads the given 51.Ar file 52and breaks it up into files of 1000 lines each. 53If 54.Ar file 55is a single dash or absent, 56.Nm 57reads from the standard input. 58.Ar file 59itself is not altered. 60.Pp 61The options are as follows: 62.Bl -tag -width Ds 63.It Fl a 64Use 65.Ar suffix_length 66letters to form the suffix of the file name. 67.It Fl b 68Create smaller files 69.Ar byte_count 70bytes in length. 71If 72.Ql k 73is appended to the number, the file is split into 74.Ar byte_count 75kilobyte pieces. 76If 77.Ql m 78is appended to the number, the file is split into 79.Ar byte_count 80megabyte pieces. 81.It Fl l 82Create smaller files 83.Ar line_count 84lines in length. 85.It Fl n 86Split file into 87.Ar chunk_count 88smaller files. 89.El 90.Pp 91If additional arguments are specified, the first is used as the name 92of the input file which is to be split. 93If a second additional argument is specified, it is used as a prefix 94for the names of the files into which the file is split. 95In this case, each file into which the file is split is named by the 96prefix followed by a lexically ordered suffix using 97.Ar suffix_length 98characters in the range 99.Dq Li a-z . 100If 101.Fl a 102is not specified, two letters are used as the suffix. 103.Pp 104If the 105.Ar name 106argument is not specified, 107.Ql x 108is used. 109.Sh STANDARDS 110The 111.Nm 112utility conforms to 113.St -p1003.1-2001 . 114.Sh HISTORY 115A 116.Nm 117command appeared in 118.At v6 . 119.Pp 120The 121.Fl a 122option was introduced in 123.Nx 2.0 . 124Before that, if 125.Ar name 126was not specified, 127.Nm 128would vary the first letter of the filename 129to increase the number of possible output files. 130The 131.Fl a 132option makes this unnecessary. 133