4

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

2
  • You can specify a filename for the output files after <file> Commented May 25, 2014 at 4:53
  • If using a Mac like I am, you may find that you need to use the -l flag instead of --lines. Commented Apr 3, 2018 at 20:09

1 Answer 1

8

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks much .that was the answer

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.