CentOS Stream 9
Sponsored Link

Command Help

Command :   Back to index

split : split a file into pieces
[SYNOPSIS] split OPTION FILE PREFIX
OPTION
-a N generate suffixes of length N (default 2)
-b SIZE put SIZE bytes per output file
-d use numeric suffixes starting at 0, not alphabetic
-x use hex suffixes starting at 0, not alphabetic
-e do not generate empty output files with '-n'
-l N put NUMBER lines/records per output file
-n CHUNKS CHUNKS :
N ⇒ split into N files based on size of input
K/N ⇒ output Kth of N to stdout
l/N ⇒ split into N files without splitting lines/records
l/K/N ⇒ output Kth of N to stdout without splitting lines/records
r/N ⇒ like 'l' but use round robin distribution
r/K/N ⇒ likewise but only output Kth of N to stdout
 Usage example :
 [root@localhost ~]# ls -l
 total 4
 -rw-------. 1 root root 1024 Sep 19  2022 anaconda-ks.cfg
 
 [root@localhost ~]# split -a 3 -d -l 10 anaconda-ks.cfg anaconda-ks.cfg
 
 [root@localhost ~]# ls -l
 total 24
 -rw-------. 1 root root 1024 Sep 19  2022 anaconda-ks.cfg
 -rw-r--r--. 1 root root  241 Nov 17 15:14 anaconda-ks.cfg000
 -rw-r--r--. 1 root root  115 Nov 17 15:14 anaconda-ks.cfg001
 -rw-r--r--. 1 root root  206 Nov 17 15:14 anaconda-ks.cfg002
 -rw-r--r--. 1 root root  314 Nov 17 15:14 anaconda-ks.cfg003
 -rw-r--r--. 1 root root  148 Nov 17 15:14 anaconda-ks.cfg004
 

Matched Content