How to split a text file by lines on Linux?

How to split a text file by lines on Linux? For example, to split a file content.txt into many files and each split contains 1024 lines.

asked Apr 18, 2014 by Eric Z Ma (44,280 points)

1 Answer

 
Best answer

You can use the split command on Linux:

split -l 1024 content.txt splitted-content.txt-

It will generate splitted-content.txt-{aa,ab,....}

answered Apr 18, 2014 by Eric Z Ma (44,280 points)
selected Apr 20, 2014 by Eric Z Ma

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...