HOME

TheInfoList



OR:

split is a utility on
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
,
Plan 9 Plan 9 or Plan Nine may refer to: Music * Plan 9 (band), a psychedelic rock band from Rhode Island * ''Plan 9'', an album by Big Guitars From Memphis with Rick Lindy * "Plan 9", a song on the 1993 album ''Gorgeous'' by electronica band 808 Stat ...
, and
Unix-like A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
s most commonly used to split a
computer file A computer file is a computer resource for recording data in a computer storage device, primarily identified by its file name. Just as words can be written to paper, so can data be written to a computer file. Files can be shared with and trans ...
into two or more smaller files.


History

The
command Command may refer to: Computing * Command (computing), a statement in a computer language * COMMAND.COM, the default operating system shell and command-line interpreter for DOS * Command key, a modifier key on Apple Macintosh computer keyboards ...
first appeared in
Version 3 Unix The term "Research Unix" refers to early versions of the Unix operating system for DEC PDP-7, PDP-11, VAX and Interdata 7/32 and 8/32 computers, developed in the Bell Labs Computing Sciences Research Center (CSRC). History The term ''Resear ...
and is part of the
X/Open X/Open group (also known as the Open Group for Unix Systems and incorporated in 1987 as X/Open Company, Ltd.) was a consortium founded by several European UNIX systems manufacturers in 1984 to identify and promote open standards in the field of in ...
Portability Guide since issue 2 of 1987. It was inherited into the first version of POSIX.1 and the Single Unix Specification. The version of split bundled in
GNU coreutils The GNU Core Utilities or coreutils is a package of GNU software containing implementations for many of the basic tools, such as cat, ls, and rm, which are used on Unix-like operating systems. In September 2002, the ''GNU coreutils'' were cr ...
was written by Torbjorn Granlund and
Richard Stallman Richard Matthew Stallman (; born March 16, 1953), also known by his initials, rms, is an American free software movement activist and programmer. He campaigns for software to be distributed in such a manner that its users have the freedom to u ...
. The command has also been ported to the
IBM i IBM i (the ''i'' standing for ''integrated'') is an operating system developed by IBM for IBM Power Systems. It was originally released in 1988 as OS/400, as the sole operating system of the IBM AS/400 line of systems. It was renamed to i5/OS i ...
operating system.


Usage

The command- syntax is: split PTION NPUT [PREFIX The default behavior of split is to generate output files of a fixed size, default 1000 lines. The files are named by appending ''aa'', ''ab'', ''ac'', etc. to ''output filename''. If ''output filename'' is not given, the default filename of ''x'' is used, for example, ''xaa'', ''xab'', etc. When a hyphen (''-'') is used instead of ''input filename'', data is derived from standard input. The files are typically rejoined using a utility such as cat (Unix), cat. Additional program options permit a maximum character count (instead of a line count), a maximum line length, how many incrementing characters in generated filenames, and whether to use letters or digits.


Split file into pieces

Create a file named "myfile.txt" with exactly 3,000 lines of data: $ head -3000 < /dev/urandom > myfile.txt Now, use the split command to break this file into pieces (note: unless otherwise specified, split will break the file into 1,000-line files): $ split myfile.txt $ ls -l -rw-r--r-- 1 root root 761K Jun 16 18:17 myfile.txt -rw-r--r-- 1 root root 242K Jun 16 18:17 xaa -rw-r--r-- 1 root root 263K Jun 16 18:17 xab -rw-r--r-- 1 root root 256K Jun 16 18:17 xac $ wc --lines xa* 1000 xaa 1000 xab 1000 xac 3000 total As seen above, the split command has broken the original file (keeping the original intact) into three, equal in number of lines (i.e., 1,000), files: xaa, xab, and xac.


See also

* csplit – splits by content rather than by size * File spanning *
List of Unix commands This is a list of Unix commands as specified by IEEE Std 1003.1-2008, which is part of the Single UNIX Specification (SUS). These commands can be found on Unix operating systems and most Unix-like operating systems. List See also * List of G ...


References


External links

* Standard Unix programs Unix SUS2008 utilities Plan 9 commands IBM i Qshell commands {{unix-stub