Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Question about quickly selecting and copying a large number of lines of code

Options
  • 23-11-2010 10:26pm
    #1
    Registered Users Posts: 714 ✭✭✭


    Hi, I want to select and copy about 20,000 lines of code (out of 50,000 lines) quickly from a text file by a method like selecting the first line and going to the last line number or a keyword in the last line. Is it possible to do this using Notepad or Wordpad?


Comments

  • Closed Accounts Posts: 4,204 ✭✭✭FoxT


    wordpad would be deadly slow.
    2 things you can try

    OPTION 1 ( I have done this)
    1 - export the code as a .txt file & import to Excel
    2 - place cursor on line 20000
    3 - press shift & down-arrow at the same time
    you now have selected the last 30k lines. Hit 'Del' to delete them.
    4- save file as text

    OPTION 2 ( i have not done this)
    Get a vi editor for windows, there are a few available free (try Winvi).
    Import your file into vi then use the write command to write out the 20k lines you want to another text file.

    If you have excel thats the one I'd try first. Excel is quite good at handling text.

    - FoxT


  • Moderators, Society & Culture Moderators Posts: 9,689 Mod ✭✭✭✭stevenmu


    Is it the first 20,000 lines? In notepad you can press Ctrl+G to go to the line after the last line you want (ie 20,001), then press Ctrl+Shift+Home to select everything back up to the start. Then just copy and paste.


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Notepad++ FTW.

    Exact same process as stevenmu posts above, but it's much better able to handle large files than notepad.


  • Closed Accounts Posts: 9,700 ✭✭✭tricky D


    +1 for NotePad++

    Just messed around with a million+ line file as a crude test with no significant delays.


  • Moderators, Society & Culture Moderators Posts: 9,689 Mod ✭✭✭✭stevenmu


    Notepad2 is another good one, I prefer it slightly to Notepad++, it's lighter weight and the non-tabbed interface suits my uses better, and it's pretty good with larger files (though not as good as NP++ for very large files iirc). But I use Visual Studio as my main code editor and just use notepad2 for a quick scratch-pad, as a main code editor I suspect NP++ would be better.


  • Advertisement
  • Registered Users Posts: 882 ✭✭✭moycullen14


    Try unix/linux/MacOS

    % sed -n '1,20000p' [input file] > [output file]


  • Registered Users Posts: 912 ✭✭✭chakotha


    Go to the start of the first line in a text editor (don't think it matters which one) and left-click mouse then press and hold Shift. Then drag the right scroll bar down to the end of the last line you want and left-click mouse again which selects the intervening text.


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    seamus wrote: »
    Notepad++ FTW.

    It's not match for my Editplus style kung-fu.


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Evil Phil wrote: »
    It's not match for my Editplus style kung-fu.
    Wait...what's this? Buy now? WTH is this? :)


Advertisement