split

split a file into manageable pieces 

Command


SYNOPSIS

split [-a n] [-l n] [file [prefix]]

split -b n[b|k|m] [-a n] [file [prefix]]

split [-n] [-a n] file [prefix]


DESCRIPTION

split breaks a file into a set of files. By default, split starts a new file every time it has copied 1000 lines.

split names the files that it creates as a prefix followed by a suffix. x is the prefix unless you specify a different prefix on the command line. Unless altered by options, the suffix begins as aa and is incremented with each new file. By default, therefore, the first file is xaa followed by xab, and so on.

Options

-a n 

uses a suffix n letters long. The default is two.

-b n[b|k|m

splits the file every n units. The default unit size is bytes. When you follow n with b, k, or m, split uses a corresponding unit size of 512 bytes, 1K (1024 bytes), or 1 megabyte (1,048,576 bytes).

-l n 

splits the file every n lines.

- n 

is an obsolete version of the -l option.

If the file is - (dash) or no file is specified, split reads the standard input.


DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

1 

Failure because of any of the following:

— error opening input or output file
— missing number after -a
— invalid -a option
— missing byte count after -b
— invalid byte count specification
— invalid count specification
— unknown option
— out of memory for binary split buffer
— read error on input file
— write error on output file
— too many names generated


PORTABILITY

POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems. Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.

The b suffix of the -b option is an extension to the POSIX.2 standard.


AVAILABILITY

PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Commands:
csplit


PTC MKS Toolkit 10.4 Documentation Build 39.