Linux split file, linuxsplit split
Introduction
Split can split a large file into multiple files of the specified size, and the splitting speed is very fast. It takes less than one second to split a 1 GB file, if you perform manual operations on windows, it is estimated that the operation will be stuck.
Option
Usage: split [OPTION]... [INPUT [PREFIX] Output fixed-size pieces of INPUT to PREFIXaa, PREFIXab ,...; defaultsize is 1000 lines, and default PREFIX is 'x '. with no INPUT, or when INPUTis-, read standard input. mandatory arguments to long options are mandatory for short options too. -a, -- suffix-length = N use suffixes of length N (default 2) Specify the suffix length of the split file-B, -- bytes = SIZE put SIZE bytes per output file: split by byte. The default unit is-C, -- line-bytes = SIZE put at most SIZE bytes of lines per output file specifies the maximum SIZE of a single row. The default unit is byte-d, -- numeric-suffixes use numeric suffixes instead of alphabetic use numbers as the suffix of the split file-l, -- lines = NUMBER put NUMBER lines per output file split by NUMBER of rows -- verbose print a diagnostic just before each output file is opened -- help display this help and exit -- version output version information and exitSIZE may be (or may be an integer optionally followed) one of following: KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y. you can specify other units with the suffix Report split bugs to bug-coreutils@gnu.orgGNU coreutils home page:
Instance
[root@localhost test]# more testabcdefg
1. Split by row
Split each three rows into one file. The split file name starts with name and uses numbers as the suffix. The length is 1.
split -l 3 test -d -a 1 name
[root@localhost test]# lltotal 16-rw-r--r--. 1 root root 6 Oct 9 19:12 name0-rw-r--r--. 1 root root 6 Oct 9 19:12 name1-rw-r--r--. 1 root root 2 Oct 9 19:12 name2-rw-r--r--. 1 root root 14 Oct 9 19:07 test
2. Split by byte
Each three bytes is split into one file. By default, the unit is byte, and the unit can be KB or MB.
split -b 3 test -d -a 1 new
[root@localhost test]# ls -l new*-rw-r--r--. 1 root root 3 Oct 9 19:13 new0-rw-r--r--. 1 root root 3 Oct 9 19:13 new1-rw-r--r--. 1 root root 3 Oct 9 19:13 new2-rw-r--r--. 1 root root 3 Oct 9 19:13 new3-rw-r--r--. 1 root root 2 Oct 9 19:13 new4
Summary
Spit commands are very practical. For example, it is much faster to split files and import them concurrently when importing data.
Note: Author: pursuer. chen Blog: http://www.cnblogs.com/chenmh All essays on this site are original. You are welcome to repost them. However, you must indicate the source of the article and clearly give the link at the beginning of the article. Welcome to discussion |