split (Unix)

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

split
Developer(s)Various implementations
Initial releaseFebruary 1973; 46 years ago (1973-02)
Operating systemUnix and Unix-like
TypeCommand

split is a utility on Unix and Unix-like operating systems most commonly used to split a computer file into two or more smaller files. The version of split bundled in GNU coreutils was written by Torbjorn Granlund and Richard Stallman.[1]

Usage[edit]

The command-syntax is:

 split [OPTION] [INPUT [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 utilitity such as 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[edit]

Let’s assume we have file name with tuxlap.txt, Use below split command to break into the pieces

[root@AAMINE1965 ~]# split tuxlap.txt
[root@AAMINE1965 ~]# ll
total 32
-rw-------. 1 root root  980 Aug 12 00:11 anaconda-ks.cfg
-rw-r--r--. 1 root root 9607 Nov 11 03:22 tuxlap.txt
-rw-r--r--. 1 root root 8744 Nov 11 03:23 xaa
-rw-r--r--. 1 root root  863 Nov 11 03:23 xab
[root@AAMINE1965 ~]#

As we can see the above output ‘tuxlab.txt‘ is split into two pieces with the name ‘xaa’ and ‘xab’.

Manual[edit]

See also[edit]

References[edit]