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.
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.
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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.