Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Split file by lines

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

like image 960
YOU Avatar asked Oct 29 '25 18:10

YOU


1 Answers

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.

like image 75
14 revs, 12 users 16% Avatar answered Oct 31 '25 07:10

14 revs, 12 users 16%