16

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.

  • @hakermania: done. – Tarun Jan 28 '14 at 8:32
19

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.

3

If you use split and create multiple files your next problem is going to be how to use Calc to manipulate all that data across all those files. And that is piling one problem onto another. With 65000 lines this will be 62(!) pages.

You are just using the wrong tool. Use Libreoffice Base or MySQL to import the data and then use Libreoffice Calc to do the calculation and/or manipulation on that data.

Regarding the limits this depends on the Libreofficeversion you are using:

  • pre 3.3.3: limit is 65 536 rows
  • 3.3.3 and later: 1 048 576 rows (1M)

If you want you can do 4m records with 3.3.3+ with 4 pages but the Base module of LibreOffice can import with almost no row limit at all if that is not enough. Here is an intro in how to do this and here is an example database with import file. Manipulating the data in Base is easy and quick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.