Ubuntu – Command to split a text file according to number of lines

command line

The situation:

I have a text file which is about 1.5GB containing about 4000000 lines.

I want to import this to Libreoffice calc and as u know you can't import this huge file with large number of lines(i think maximum is 65000 line).

Anyway what i need is a simple command that can split this file into smaller files with number of lines in each file < 65000 line.

Best Answer

You can use the split command:

split -l N /path-to-file

Where N is the maximum number of lines that could be in a file.

This command will split the file into smaller files each with N number of lines.

Use man split for more info.