Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
@hakermania: done. –  Tarun Jan 28 at 8:32

2 Answers 2

up vote 6 down vote accepted

You can use split command example

split -l N /path-to-file

where N is the maxium number of lines that could be in a file.

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

Use man split for more info.

share|improve this answer
    
just for newbies plz edit your answer replace split -l 65000 with split -l N /path-to-file when N is max number of lines that could be in a file –  Ask Jan 28 at 8:35

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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