Reputation: 63
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.
Upvotes: 2
Views: 4382
Reputation: 15309
Upvotes: 0
Reputation: 133360
You can go to the line using menu > Goto > Goto Line...
or press Ctrl+G.
You might be looking for the Mark
feature:
Edit > Mark > Set Mark
to set your selection-end marker.Edit > Mark > Delete to Mark
Otherwise, you can write a code for open file as text ... delete the rows you need, save and ... close.
Upvotes: 5
Reputation: 343
If your file turns out to be too big to edit in Sublime Text, at a Linux command line you could do:
sed -ne '/johnd/,$p' myfile.txt > edited.txt
mv edited.txt myfile.txt
That prints all of the lines from the one matching johnd
to the end of the file. The output is captured to a new file and then renamed back to replace the original file.
Upvotes: 0
Reputation: 6509
A bit of a hack, and it only works if there is at least one type of brackets that are not used in the text.
(
, [
or {
).)
, ]
or }
)There's probably a better way to do this, but it's the solution I could think of.
Upvotes: 0