1. Function: Split large files into multiple small files
2. Usage: Split [parameter] file [name]
3. Parameters:
-B: Divide the document by byte size;
-D: Use a number as a suffix.
-L: The value is the size of the number of columns per output file.
4. Example
[Email protected] ~]$ Head-10/etc/passwd>/home/mysql/passwd.txt
Example 1: Dividing the/home/mysql/passwd.txt by 4 rows per file
[Email protected] ~]$ split-4 passwd.txt
[[email protected] ~]$ for file in ' ls|grep-v "Passwd.txt" ';d o echo ' wc-l $file ';
4 XAA
4 Xab
2 Xac
These three are automatically named files, and the source files are still present after the file is split. The source files are 10 lines in total, divided by 4 rows per file, and the number of rows for three files is 4,4,2.
Example 2: Splitting a file by byte
[Email protected] ~]$ Split-b passwd.txt
[Email protected] ~]$ more XAA
Root:x:0:0:root:/root:/bin/bash
Bin:x:1:1:bin:/bin:/sbin/nologin
Daemon:x:2:2:daemon:/sbin:/sbin/nologin
Adm:x:3:4:adm:/var/adm:/sbin/nologin
Lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/
[Email protected] ~]$ more Xab
Sbin:/bin/sync
Shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
Halt:x:7:0:halt:/sbin:/sbin/halt
Mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
Uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
File discontinuity occurs by byte splitting
Example 3: Specifying the file name and starting number
[Email protected] ~]$ split-l 4 passwd.txt "passwd"-D
[[email protected] ~]$ ls |grep-v "Passwd.txt"
Passwd00
Passwd01
Passwd02
The file name is changed to a format that begins with passwd and ends with a number.
Linux Common Commands--split