0

I've long list of text,text line 1 to line 1000000000, i would like to ask, let say i would like to make selection and copy to specific line from line 100 to 1000..only, is it possible and how to that in notepad++.. thanks

  • The question is not clear. What are you trying to do beyond cut-and-paste? Is it special because of the format of the file? Are you attempting to create a macro? – Adam Hawkes Feb 27 '12 at 15:56

1 Answers1

0

Notepad++ doesn't have this functionality. You can navigate to a line with no problems using Search -> Go to... and choose the line numbers but this doesn't let you highlight the lines between the start and end point.

What you should do is use a scripting language to extract the lines you want. It is quick, easy, and free to install. I'd do the following:

  1. Install Python
  2. Create a text file and save it with a .py extension and type in the following simple script:

    #!usr/bin/env python
    fp = open("outputfile.txt","w")
    fp.write(''.join(open('inputfile.txt', 'r').readlines()[100:1000]))
    fp.close()
    

    inputfile.txt is the file containing the million lines, and outputfile.txt is the file that Python dumps the lines you want into. Note that if the input file contains 10000000 lines, we are specifying in the above lines that we only want lines 100 to 1000.

  3. Make sure the Python script and the input file are in the same path. The output file will also be dumped in the same path
  4. Run the script like any other Python script

Once you have your output file, it's just a matter of using Ctrl+A to select all and doing whatever you want with the text.

One point though: I don't think Notepad++ can even open very large text files. Depending on the type of data contained in it and based on my personal experience, N++ works for files below 200MB in size. So if you have a million line file with a LOT of data, you shouldn't even be trying to open it in N++. That's just an opinion though.

Another similar Stackoverflow question shows a Perl script that does the same thing. Choose whichever option you wish (Python or Perl), but since I'm a Python guy, I say choose the former :)

Community
  • 1
  • 1
prrao
  • 2,656
  • 5
  • 34
  • 39