|
Packit |
7cfc04 |
'\" et
|
|
Packit |
7cfc04 |
.TH SPLIT "1P" 2013 "IEEE/The Open Group" "POSIX Programmer's Manual"
|
|
Packit |
7cfc04 |
.SH PROLOG
|
|
Packit |
7cfc04 |
This manual page is part of the POSIX Programmer's Manual.
|
|
Packit |
7cfc04 |
The Linux implementation of this interface may differ (consult
|
|
Packit |
7cfc04 |
the corresponding Linux manual page for details of Linux behavior),
|
|
Packit |
7cfc04 |
or the interface may not be implemented on Linux.
|
|
Packit |
7cfc04 |
|
|
Packit |
7cfc04 |
.SH NAME
|
|
Packit |
7cfc04 |
split
|
|
Packit |
7cfc04 |
\(em split files into pieces
|
|
Packit |
7cfc04 |
.SH SYNOPSIS
|
|
Packit |
7cfc04 |
.LP
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
split \fB[\fR\(mil \fIline_count\fB] [\fR\(mia \fIsuffix_length\fB] [\fIfile\fB[\fIname\fB]]\fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
split \(mib \fIn\fB[\fRk|m\fB] [\fR\(mia \fIsuffix_length\fB] [\fIfile\fB[\fIname\fB]]\fR
|
|
Packit |
7cfc04 |
.fi
|
|
Packit |
7cfc04 |
.SH DESCRIPTION
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.IR split
|
|
Packit |
7cfc04 |
utility shall read an input file and write one or more output files.
|
|
Packit |
7cfc04 |
The default size of each output file shall be 1\|000 lines. The size
|
|
Packit |
7cfc04 |
of the output files can be modified by specification of the
|
|
Packit |
7cfc04 |
.BR \(mib
|
|
Packit |
7cfc04 |
or
|
|
Packit |
7cfc04 |
.BR \(mil
|
|
Packit |
7cfc04 |
options. Each output file shall be created with a unique suffix. The
|
|
Packit |
7cfc04 |
suffix shall consist of exactly
|
|
Packit |
7cfc04 |
.IR suffix_length
|
|
Packit |
7cfc04 |
lowercase letters from the POSIX locale. The letters of the suffix
|
|
Packit |
7cfc04 |
shall be used as if they were a base-26 digit system, with the first
|
|
Packit |
7cfc04 |
suffix to be created consisting of all
|
|
Packit |
7cfc04 |
.BR 'a'
|
|
Packit |
7cfc04 |
characters, the second with a
|
|
Packit |
7cfc04 |
.BR 'b'
|
|
Packit |
7cfc04 |
replacing the last
|
|
Packit |
7cfc04 |
.BR 'a' ,
|
|
Packit |
7cfc04 |
and so on, until a name of all
|
|
Packit |
7cfc04 |
.BR 'z'
|
|
Packit |
7cfc04 |
characters is created. By default, the names of the output files shall
|
|
Packit |
7cfc04 |
be
|
|
Packit |
7cfc04 |
.BR 'x' ,
|
|
Packit |
7cfc04 |
followed by a two-character suffix from the character set as described
|
|
Packit |
7cfc04 |
above, starting with
|
|
Packit |
7cfc04 |
.BR \(dqaa\(dq ,
|
|
Packit |
7cfc04 |
.BR \(dqab\(dq ,
|
|
Packit |
7cfc04 |
.BR \(dqac\(dq ,
|
|
Packit |
7cfc04 |
and so on, and continuing until the suffix
|
|
Packit |
7cfc04 |
.BR \(dqzz\(dq ,
|
|
Packit |
7cfc04 |
for a maximum of 676 files.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
If the number of files required exceeds the maximum allowed by the
|
|
Packit |
7cfc04 |
suffix length provided, such that the last allowable file would be
|
|
Packit |
7cfc04 |
larger than the requested size, the
|
|
Packit |
7cfc04 |
.IR split
|
|
Packit |
7cfc04 |
utility shall fail after creating the last file with a valid suffix;
|
|
Packit |
7cfc04 |
.IR split
|
|
Packit |
7cfc04 |
shall not delete the files it created with valid suffixes. If the file
|
|
Packit |
7cfc04 |
limit is not exceeded, the last file created shall contain the
|
|
Packit |
7cfc04 |
remainder of the input file, and may be smaller than the requested
|
|
Packit |
7cfc04 |
size.
|
|
Packit |
7cfc04 |
.SH OPTIONS
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.IR split
|
|
Packit |
7cfc04 |
utility shall conform to the Base Definitions volume of POSIX.1\(hy2008,
|
|
Packit |
7cfc04 |
.IR "Section 12.2" ", " "Utility Syntax Guidelines".
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The following options shall be supported:
|
|
Packit |
7cfc04 |
.IP "\fB\(mia\ \fIsuffix_length\fR" 10
|
|
Packit |
7cfc04 |
.br
|
|
Packit |
7cfc04 |
Use
|
|
Packit |
7cfc04 |
.IR suffix_length
|
|
Packit |
7cfc04 |
letters to form the suffix portion of the filenames of the split
|
|
Packit |
7cfc04 |
file. If
|
|
Packit |
7cfc04 |
.BR \(mia
|
|
Packit |
7cfc04 |
is not specified, the default suffix length shall be two. If the sum
|
|
Packit |
7cfc04 |
of the
|
|
Packit |
7cfc04 |
.IR name
|
|
Packit |
7cfc04 |
operand and the
|
|
Packit |
7cfc04 |
.IR suffix_length
|
|
Packit |
7cfc04 |
option-argument would create a filename exceeding
|
|
Packit |
7cfc04 |
{NAME_MAX}
|
|
Packit |
7cfc04 |
bytes, an error shall result;
|
|
Packit |
7cfc04 |
.IR split
|
|
Packit |
7cfc04 |
shall exit with a diagnostic message and no files shall be created.
|
|
Packit |
7cfc04 |
.IP "\fB\(mib\ \fIn\fR" 10
|
|
Packit |
7cfc04 |
Split a file into pieces
|
|
Packit |
7cfc04 |
.IR n
|
|
Packit |
7cfc04 |
bytes in size.
|
|
Packit |
7cfc04 |
.IP "\fB\(mib\ \fIn\fBk\fR" 10
|
|
Packit |
7cfc04 |
Split a file into pieces
|
|
Packit |
7cfc04 |
.IR n *1\|024
|
|
Packit |
7cfc04 |
bytes in size.
|
|
Packit |
7cfc04 |
.IP "\fB\(mib\ \fIn\fBm\fR" 10
|
|
Packit |
7cfc04 |
Split a file into pieces
|
|
Packit |
7cfc04 |
.IR n *1\|048\|576
|
|
Packit |
7cfc04 |
bytes in size.
|
|
Packit |
7cfc04 |
.IP "\fB\(mil\ \fIline_count\fR" 10
|
|
Packit |
7cfc04 |
Specify the number of lines in each resulting file piece. The
|
|
Packit |
7cfc04 |
.IR line_count
|
|
Packit |
7cfc04 |
argument is an unsigned decimal integer. The default is 1\|000. If
|
|
Packit |
7cfc04 |
the input does not end with a
|
|
Packit |
7cfc04 |
<newline>,
|
|
Packit |
7cfc04 |
the partial line shall be included in the last output file.
|
|
Packit |
7cfc04 |
.SH OPERANDS
|
|
Packit |
7cfc04 |
The following operands shall be supported:
|
|
Packit |
7cfc04 |
.IP "\fIfile\fR" 10
|
|
Packit |
7cfc04 |
The pathname of the ordinary file to be split. If no input file is
|
|
Packit |
7cfc04 |
given or
|
|
Packit |
7cfc04 |
.IR file
|
|
Packit |
7cfc04 |
is
|
|
Packit |
7cfc04 |
.BR '\(mi' ,
|
|
Packit |
7cfc04 |
the standard input shall be used.
|
|
Packit |
7cfc04 |
.IP "\fIname\fR" 10
|
|
Packit |
7cfc04 |
The prefix to be used for each of the files resulting from the split
|
|
Packit |
7cfc04 |
operation. If no
|
|
Packit |
7cfc04 |
.IR name
|
|
Packit |
7cfc04 |
argument is given,
|
|
Packit |
7cfc04 |
.BR 'x'
|
|
Packit |
7cfc04 |
shall be used as the prefix of the output files. The combined length
|
|
Packit |
7cfc04 |
of the basename of
|
|
Packit |
7cfc04 |
.IR prefix
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.IR suffix_length
|
|
Packit |
7cfc04 |
cannot exceed
|
|
Packit |
7cfc04 |
{NAME_MAX}
|
|
Packit |
7cfc04 |
bytes. See the OPTIONS section.
|
|
Packit |
7cfc04 |
.SH STDIN
|
|
Packit |
7cfc04 |
See the INPUT FILES section.
|
|
Packit |
7cfc04 |
.SH "INPUT FILES"
|
|
Packit |
7cfc04 |
Any file can be used as input.
|
|
Packit |
7cfc04 |
.SH "ENVIRONMENT VARIABLES"
|
|
Packit |
7cfc04 |
The following environment variables shall affect the execution of
|
|
Packit |
7cfc04 |
.IR split :
|
|
Packit |
7cfc04 |
.IP "\fILANG\fP" 10
|
|
Packit |
7cfc04 |
Provide a default value for the internationalization variables that are
|
|
Packit |
7cfc04 |
unset or null. (See the Base Definitions volume of POSIX.1\(hy2008,
|
|
Packit |
7cfc04 |
.IR "Section 8.2" ", " "Internationalization Variables"
|
|
Packit |
7cfc04 |
for the precedence of internationalization variables used to determine
|
|
Packit |
7cfc04 |
the values of locale categories.)
|
|
Packit |
7cfc04 |
.IP "\fILC_ALL\fP" 10
|
|
Packit |
7cfc04 |
If set to a non-empty string value, override the values of all the
|
|
Packit |
7cfc04 |
other internationalization variables.
|
|
Packit |
7cfc04 |
.IP "\fILC_CTYPE\fP" 10
|
|
Packit |
7cfc04 |
Determine the locale for the interpretation of sequences of bytes of
|
|
Packit |
7cfc04 |
text data as characters (for example, single-byte as opposed to
|
|
Packit |
7cfc04 |
multi-byte characters in arguments and input files).
|
|
Packit |
7cfc04 |
.IP "\fILC_MESSAGES\fP" 10
|
|
Packit |
7cfc04 |
.br
|
|
Packit |
7cfc04 |
Determine the locale that should be used to affect the format and
|
|
Packit |
7cfc04 |
contents of diagnostic messages written to standard error.
|
|
Packit |
7cfc04 |
.IP "\fINLSPATH\fP" 10
|
|
Packit |
7cfc04 |
Determine the location of message catalogs for the processing of
|
|
Packit |
7cfc04 |
.IR LC_MESSAGES .
|
|
Packit |
7cfc04 |
.SH "ASYNCHRONOUS EVENTS"
|
|
Packit |
7cfc04 |
Default.
|
|
Packit |
7cfc04 |
.SH STDOUT
|
|
Packit |
7cfc04 |
Not used.
|
|
Packit |
7cfc04 |
.SH STDERR
|
|
Packit |
7cfc04 |
The standard error shall be used only for diagnostic messages.
|
|
Packit |
7cfc04 |
.SH "OUTPUT FILES"
|
|
Packit |
7cfc04 |
The output files contain portions of the original input file; otherwise,
|
|
Packit |
7cfc04 |
unchanged.
|
|
Packit |
7cfc04 |
.SH "EXTENDED DESCRIPTION"
|
|
Packit |
7cfc04 |
None.
|
|
Packit |
7cfc04 |
.SH "EXIT STATUS"
|
|
Packit |
7cfc04 |
The following exit values shall be returned:
|
|
Packit |
7cfc04 |
.IP "\00" 6
|
|
Packit |
7cfc04 |
Successful completion.
|
|
Packit |
7cfc04 |
.IP >0 6
|
|
Packit |
7cfc04 |
An error occurred.
|
|
Packit |
7cfc04 |
.SH "CONSEQUENCES OF ERRORS"
|
|
Packit |
7cfc04 |
Default.
|
|
Packit |
7cfc04 |
.LP
|
|
Packit |
7cfc04 |
.IR "The following sections are informative."
|
|
Packit |
7cfc04 |
.SH "APPLICATION USAGE"
|
|
Packit |
7cfc04 |
None.
|
|
Packit |
7cfc04 |
.SH EXAMPLES
|
|
Packit |
7cfc04 |
In the following examples
|
|
Packit |
7cfc04 |
.BR foo
|
|
Packit |
7cfc04 |
is a text file that contains 5\|000 lines.
|
|
Packit |
7cfc04 |
.IP " 1." 4
|
|
Packit |
7cfc04 |
Create five files,
|
|
Packit |
7cfc04 |
.BR xaa ,
|
|
Packit |
7cfc04 |
.BR xab ,
|
|
Packit |
7cfc04 |
.BR xac ,
|
|
Packit |
7cfc04 |
.BR xad ,
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR xae :
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
split foo
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.IP " 2." 4
|
|
Packit |
7cfc04 |
Create five files, but the suffixed portion of the created
|
|
Packit |
7cfc04 |
files consists of three letters,
|
|
Packit |
7cfc04 |
.BR xaaa ,
|
|
Packit |
7cfc04 |
.BR xaab ,
|
|
Packit |
7cfc04 |
.BR xaac ,
|
|
Packit |
7cfc04 |
.BR xaad ,
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR xaae :
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
split \(mia 3 foo
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.IP " 3." 4
|
|
Packit |
7cfc04 |
Create three files with four-letter suffixes and a supplied prefix,
|
|
Packit |
7cfc04 |
.BR bar_aaaa ,
|
|
Packit |
7cfc04 |
.BR bar_aaab ,
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR bar_aaac :
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
split \(mia 4 \(mil 2000 foo bar_
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.IP " 4." 4
|
|
Packit |
7cfc04 |
Create as many files as are necessary to contain at most 20*1\|024
|
|
Packit |
7cfc04 |
bytes, each with the default prefix of
|
|
Packit |
7cfc04 |
.BR x
|
|
Packit |
7cfc04 |
and a five-letter suffix:
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.sp
|
|
Packit |
7cfc04 |
.RS 4
|
|
Packit |
7cfc04 |
.nf
|
|
Packit |
7cfc04 |
\fB
|
|
Packit |
7cfc04 |
split \(mia 5 \(mib 20k foo
|
|
Packit |
7cfc04 |
.fi \fR
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.RE
|
|
Packit |
7cfc04 |
.SH RATIONALE
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.BR \(mib
|
|
Packit |
7cfc04 |
option was added to provide a mechanism for splitting files other than
|
|
Packit |
7cfc04 |
by lines. While most uses of the
|
|
Packit |
7cfc04 |
.BR \(mib
|
|
Packit |
7cfc04 |
option are for transmitting files over networks, some believed it would
|
|
Packit |
7cfc04 |
have additional uses.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.BR \(mia
|
|
Packit |
7cfc04 |
option was added to overcome the limitation of being able to create
|
|
Packit |
7cfc04 |
only 676 files.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
Consideration was given to deleting this utility, using the rationale
|
|
Packit |
7cfc04 |
that the functionality provided by this utility is available via the
|
|
Packit |
7cfc04 |
.IR csplit
|
|
Packit |
7cfc04 |
utility (see
|
|
Packit |
7cfc04 |
.IR "\fIcsplit\fR\^").
|
|
Packit |
7cfc04 |
Upon reconsideration of the purpose of the User Portability Utilities
|
|
Packit |
7cfc04 |
option, it was decided to retain both this utility and the
|
|
Packit |
7cfc04 |
.IR csplit
|
|
Packit |
7cfc04 |
utility because users use both utilities and have historical
|
|
Packit |
7cfc04 |
expectations of their behavior. Furthermore, the splitting on byte
|
|
Packit |
7cfc04 |
boundaries in
|
|
Packit |
7cfc04 |
.IR split
|
|
Packit |
7cfc04 |
cannot be duplicated with the historical
|
|
Packit |
7cfc04 |
.IR csplit .
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The text ``\c
|
|
Packit |
7cfc04 |
.IR split
|
|
Packit |
7cfc04 |
shall not delete the files it created with valid suffixes'' would
|
|
Packit |
7cfc04 |
normally be assumed, but since the related utility,
|
|
Packit |
7cfc04 |
.IR csplit ,
|
|
Packit |
7cfc04 |
does delete files under some circumstances, the historical behavior of
|
|
Packit |
7cfc04 |
.IR split
|
|
Packit |
7cfc04 |
is made explicit to avoid misinterpretation.
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
Earlier versions of this standard allowed a
|
|
Packit |
7cfc04 |
.BR \(mi \c
|
|
Packit |
7cfc04 |
.IR line_count
|
|
Packit |
7cfc04 |
option. This form is no longer specified by POSIX.1\(hy2008 but may be
|
|
Packit |
7cfc04 |
present in some implementations.
|
|
Packit |
7cfc04 |
.SH "FUTURE DIRECTIONS"
|
|
Packit |
7cfc04 |
None.
|
|
Packit |
7cfc04 |
.SH "SEE ALSO"
|
|
Packit |
7cfc04 |
.IR "\fIcsplit\fR\^"
|
|
Packit |
7cfc04 |
.P
|
|
Packit |
7cfc04 |
The Base Definitions volume of POSIX.1\(hy2008,
|
|
Packit |
7cfc04 |
.IR "Chapter 8" ", " "Environment Variables",
|
|
Packit |
7cfc04 |
.IR "Section 12.2" ", " "Utility Syntax Guidelines"
|
|
Packit |
7cfc04 |
.SH COPYRIGHT
|
|
Packit |
7cfc04 |
Portions of this text are reprinted and reproduced in electronic form
|
|
Packit |
7cfc04 |
from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
|
|
Packit |
7cfc04 |
-- Portable Operating System Interface (POSIX), The Open Group Base
|
|
Packit |
7cfc04 |
Specifications Issue 7, Copyright (C) 2013 by the Institute of
|
|
Packit |
7cfc04 |
Electrical and Electronics Engineers, Inc and The Open Group.
|
|
Packit |
7cfc04 |
(This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
|
|
Packit |
7cfc04 |
event of any discrepancy between this version and the original IEEE and
|
|
Packit |
7cfc04 |
The Open Group Standard, the original IEEE and The Open Group Standard
|
|
Packit |
7cfc04 |
is the referee document. The original Standard can be obtained online at
|
|
Packit |
7cfc04 |
http://www.unix.org/online.html .
|
|
Packit |
7cfc04 |
|
|
Packit |
7cfc04 |
Any typographical or formatting errors that appear
|
|
Packit |
7cfc04 |
in this page are most likely
|
|
Packit |
7cfc04 |
to have been introduced during the conversion of the source files to
|
|
Packit |
7cfc04 |
man page format. To report such errors, see
|
|
Packit |
7cfc04 |
https://www.kernel.org/doc/man-pages/reporting_bugs.html .
|