Deleting text after a certain line number

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
Sitethief
Posts: 2
Joined: Wed Sep 02, 2009 1:52 pm

Deleting text after a certain line number

Post 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
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post 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
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post 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?
Hope this was helpful.............good luck,
Bob
Sitethief
Posts: 2
Joined: Wed Sep 02, 2009 1:52 pm

Post 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.
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post 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
-----------------------------------------
Last edited by Bob Hansen on Fri Sep 04, 2009 2:07 pm, edited 1 time in total.
Hope this was helpful.............good luck,
Bob
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post 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.
Post Reply