Page 1 of 1

Deleting text after a certain line number

Posted: Wed Sep 02, 2009 1:57 pm
by Sitethief
I have a text log with 583,000 lines in it. I want to delete the text after a certain line number. Can I do this in an easy way in Textpad without manually selecting it?

Thanks in advance

Posted: Wed Sep 02, 2009 6:34 pm
by MudGuard
why do you want to avoid manually selecting the text after that line?

Go to beginning of first line to delete,
press Ctrl-Shift-End, *)
then press delete.

Seems easy enough for me.



*) or whatever key stroke is assigned to DocumentEndExtend

Posted: Thu Sep 03, 2009 4:14 pm
by Bob Hansen
The suggestion for easy manual delete is good, but I think he wants to avoid going to the line to select it for deletion.

It could be done with RegEx but would require putting the exact number of \n chars from the cursor position since TextPad RegEx is line based. Maybe WildEdit would do a better job because it can handle multiple lines?

Posted: Thu Sep 03, 2009 6:32 pm
by Sitethief
I wanted to avoid scrolling down the entire section. Takes me roughly 20 minutes of pushing one mouse button...............

But I solved it, by putting the same keyword at the end as at the beginning.

Posted: Fri Sep 04, 2009 12:48 am
by Bob Hansen
If the line has a keyword at the end, then you can use RegEX to delete that line. Not sure if you wanted to delete the next line, or all of the following lines. This will not work for multiple lines unless they all have the same keyword.

Search for: ^.*keyword\n
Replace with: nothing

====================
Use the following settings:
-----------------------------------------
[X] Regular expression
Replace All
-----------------------------------------

Posted: Fri Sep 04, 2009 10:21 am
by MudGuard
Sitethief wrote: I have a text log with 583,000 lines in it. I want to delete the text after a certain line number.
[...]
I wanted to avoid scrolling down the entire section. Takes me roughly 20 minutes of pushing one mouse button
In your first posting, you mentioned a line number.

Ctrl-G (Or Search - Go To), then select "Line", then enter the number, then click Go To.