首页
首页 » 文件管理 » split

split

split
功能说明:切割文件。
语  法:split [--help][--version][-<行数>][-b <字节>][-C <字节>][-l <行数>][要切割的文件][输出文件名]
补充说明:split可将文件切成较小的文件,预设每1000行会切成一个小文件。
参  数:
 -<行数>或-l<行数>  指定每多少行就要切成一个小文件。 
 -b<字节>  指定每多少字就要切成一个小文件。 
 -C<字节>  与-b参数类似,但切割时尽量维持每行的完整性。 
 --help  显示帮助。 
 --version  显示版本信息。 
 [输出文件名]  设置切割后文件的前置文件名,split会自动在前置文件名后再加上编号。

split

split [options] [infile [prefix] ]

Split infile into equal-sized segments. infile remains unchanged, and the results are written to prefixaa, prefixab, and so on. The default prefix is x, giving the output files xaa, xab, etc. If infile is - or missing, standard input is read. See also csplit.

Options

-a n, --suffix-length=n

Use suffixes of length n (default is 2).

-b n[b|k|m] , --bytes=n[b|k|m]

Split infile into n-byte segments. Alternate block sizes may be specified:

b

512 bytes.

k

1 kilobyte.

m

1 megabyte.

-C bytes[b|k|m] , --line-bytes=bytes[b|k|m]

Put a maximum of bytes into file; insist on adding complete lines.

-d, --numeric-suffixes

Use numeric suffixes instead of alphabetic suffixes for the output filenames.

-n, -l n, --lines=n

Split infile into n-line segments (default is 1000).

--help

Print a help message and then exit.

--verbose

Print a message for each output file.

--version

Print version information and then exit.

Examples

Break bigfile into 1000-line segments:

split bigfile

Concatenate four files, then split them into 10-line files named new.aa, new.ab, and so on. Note that without the -, new. would be treated as a nonexistent input file:

cat list[1-4] | split -10 - new.