Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a 5 million plus line plain text file. Windows Notepad can't do anything and gets stuck when double clicking the file. Notepad++ is able to open the file though, even with 5M lines. I want to split the file into 10 single text files - i.e. the first 50K lines would be in an individual file, and so the next and next.

The problem is that when I Ctrl+G and go to the 50kth line, I have to hold shift, pressing the up arrow until the first 50k lines are selected. It takes several minutes. Is there any easier way to split up the files?

share|improve this question
2  
This may be a task better handled by the command line. –  iglvzx Nov 8 '11 at 1:31

2 Answers 2

Shift-control-home will highlight from the current position to the top of the file.

share|improve this answer
    
wow this is indeed a shortcut for me,,even though it takes time,, i think it's much faster than just pressing shift+up and wait.. –  robertshare Nov 9 '11 at 1:05
    
The "real" question should be "is there a utility that will split a text file into smaller files based on a number of lines". I think that would be a better solution to the underlying requirement. –  Paul Nov 9 '11 at 1:59

You might give SPLIT in GnuWin32 a try. Simply:

split --lines=50000 YourInputFile.dat OutputFile.

will generate:

OutputFile.aa
OutputFile.ab
OutputFile.ac
OutputFile.ad
 .
 .

each with 50,000 records. The final file will contain the remainder.

share|improve this answer
    
thanks, i really want to try what you said, but i know so little about gnuwin32.. –  robertshare Nov 9 '11 at 1:03
    
It can be a simple as downloading the core utilities (from gnuwin32.sourceforge.net/packages/coreutils.htm) and installing. Then, invoke split from wherever you've installed it. –  BillP3rd Nov 11 '11 at 0:38

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.