Split a file into multiple files

Split a file into multiple under Linux or Unix-like


split -l 20000 filename.txt -a 3 -d filename_&&ls|grep filename_|xargs -n1 -i mv {} {}.txt

选项(options)
 -b:选项后跟期望切割后的单个文件的大小,单位k或者m
     eg. split -b 1024m test.txt  //将test.txt按照每1024m切割为一个小文件
 -l:选项后跟期望切割后单个文件的行数,直接写数字
     eg. split -l 1000 test.txt //将test.txt按照每1000行切割为一个小文件
 -C:与选项-b相似,但是在切割时将尽量维持每行的完整性
    
 -d:使用数字作为后缀
 -a:配合选项-d,指定后缀长度
     eg. split -b 10k test.txt -d -a 3 split_file
        结果:test.txt split_file000 split_file001 split_file002 ...


One file is divided into multiple files under Windows. It is recommended to use the TXTKiller tool.
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_37980436/article/details/105768352