Linux basic command-split
Split
Cut a large file into smaller files, cutting every 1000 lines by default. The split file is named xaa, xab, xac and so on by default. Users can also specify the prefix of the name, for example, specify the prefix test, then the split files are testaa, testab, testac, and so on.
The scope of this command: RedHat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.
1. Grammar
Split [OPTION]... [INPUT [PREFIX]
2. List of options
Option
Description
-- help
Show help documentation
-- version
Display version information
-a |-- suffix-length=N
Use a suffix of length N (default is 2)
-b |-- bytes=SIZE
Set how many bytes to split at a time
-C size |-- line-size=size
Set a maximum of size bytes per line
-d |-- numeric-suffixes
Replace letters with numeric suffixes
-l num |-- line=num |-num
Set the number of rows to be cut
-- verbose
Print a diagnostic file before opening each output file
3. Examples
1) split every 2 lines
[root@localhost weijie] # split-2 5.c / / split every 2 lines
[root@localhost weijie] # ls
1.c 1.c ~ 2.c 3.c 4.c 4.c ~ 5.c xaa xab xac / / split files will be named automatically
[root@localhost weijie] # cat xaa / / View split files
1,2c1,2
< 123 [root@localhost weijie]# cat xab < 23 --- [root@localhost weijie]# cat xac >12345
> 2334
2) split every 10 bytes and specify the name prefix of the output file
[root@localhost weijie] # split-b 10 5.c Tsplit / / 10 bytes split, prefix name Tsplit
[root@localhost weijie] # ls
1.c 1.c ~ 2.c 3.c 4.c 4.c ~ 5.c Tsplitaa Tsplitab Tsplitac Tsplitad xaa xab xac
[root@localhost weijie] # cat Tsplitaa
1,2c1,2
< [root@localhost weijie] # cat Tsplitab
one hundred and twenty three
< 23
A Linux learning platform has been made, and a prototype has come out at present, which you can refer to and use.
Link: https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ password: n7bk