[linux application] split a large file into small files by line

For example, a BLM.txt file is divided into 1000 small files prefixed with BLM_, the suffix is ​​in the form of coefficients, and the suffix is ​​in the form of 4 digits

 use first

wc -l BLM.txt #Read how many lines there are in BLM.txt.

Reuse the split command

split -l 2482 ../BLM/BLM.txt -d -a 4 BLM_

Here the parameter -l is the number of lines of each small file, the maximum number of lines cannot exceed the number of lines of the file to be divided, followed by the file to be divided, -d means that the coefficient is a number instead of a letter -a means that the coefficient is a four-digit number. The latter BLM_ is the prefix of the coefficient.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324600808&siteId=291194637