Search code examples
filetextsublimetext3sublimetext

Deleting all the lines before a WORD on sublime text


I have a Big Text File that contains +1M Lines

and there's a word johnd on line 45280525. I want to delete all the lines before it.

How I can do that using Sublime Text?

Note that Notepad++ won't work with this file.


Solution

  • You can go to the line using menu > Goto > Goto Line...

    or press Ctrl+G.

    You might be looking for the Mark feature:

    • Ctrl+G to go to the last line you want to select, by number.
    • Edit > Mark > Set Mark to set your selection-end marker.
    • Ctrl+G (or Ctrl+Home) to go to the first line you want to select.
    • Edit > Mark > Delete to Mark

    Otherwise, you can write a code for open file as text ... delete the rows you need, save and ... close.