Split file by lines

bash, linux, shell, split

Solution

This should work for the second format you requested (`000`, `001`, `002` etc.):

`split --lines=100 -d -a 3 file ''`

The double single-quotes at the end allow us to override the default prefix (which is x), and replace it with nothing. Try `man split` to see what the other arguments do.

Problem

i use ``` split --lines=100 file ``` to split file ,and output file has name : ``` xaa ,xab ,xac ,xad ... ``` Is there any way to make output 's name : ``` 1,2,3,4 ... OR 001,002,003,004,... ``` Thanks

Original source