Page 1 of 1

Delete everything following line 100

Posted: Sat May 27, 2017 12:42 pm
by nkormanik
Say we have a standard text file containing 150 lines. We want to delete EVERYTHING after line 100. Including linefeeds/carriage returns.

Following the change, when we open the file in a text editor, and hit Ctrl-End to get to the bottom, we end up at line 100.

The last 50 lines have been totally removed.

How best to do this??

Thanks much!

Nicholas Kormanik

Re: Delete everything following line 100

Posted: Thu Jun 01, 2017 10:51 am
by DigitalVolcano
You can blank the lines after 100 the following way:

Click on the 'Limit to lines' tab and set 'From line' to 101. Uncheck the 'To' option.

Then, Click on the Regular Expression tab and set:

Regex:
.*
Replace:
(leave this blank)

The only issue with this is that it leaves blank lines after 100 rather than removing the lines. You'll then need to remove them in another pass using a regular expression:

Change back to 'Read entire file' (not limit to lines)

RegEx:
\s*$
Replace
(leave this blank)

Make sure the 'dot matches newline' and 'multi line anchors' options are not checkmarked.

Re: Delete everything following line 100

Posted: Thu Jun 01, 2017 11:06 am
by nkormanik
Greatly appreciate your getting back to me and clearly explaining.

Very glad to know that it can be done. And how.

Nicholas Kormanik