Delete Lines Until Text & Delete Lines After Text

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
sysadmin
Posts: 4
Joined: Thu Mar 09, 2006 7:51 pm

Delete Lines Until Text & Delete Lines After Text

Post by sysadmin »

I'm looking to delete lines until a line with xxxxx and then keep lines of text until yyyyy. This might have to be 2 passes, but I'm a novice at textpad and do not know.

Thanks in advance.
User avatar
Bob Hansen
Posts: 1517
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Explanation has many interpretations. Please provide of sample of lines before and after search/replacements.
Hope this was helpful.............good luck,
Bob
spugbrap
Posts: 2
Joined: Fri Jun 16, 2006 2:13 pm
Location: Bristow, VA
Contact:

sounds like a job for a macro that includes searching

Post by spugbrap »

To perform a task like this, I would record a macro, which does this:
1. search for xxxxx from current cursor location, and enable the "Extend selection" option
2. deselect the xxxxx part and position cursor before the xxxxx
3. delete selected block
4. position cursor after the xxxxx
5. search for yyyyy (turn off "Extend selection" option at this point)
6. position cursor after the yyyyy

It's not clear what you want to happen after the yyyyy. Before stopping recording, position the cursor such that repeating the macro starting from step 1 will result in the desired behavior.

Since it's a macro, you can run it however many times you need to, and even save it for future use, if you want to.

Other than that, search/replace across multiple lines is very particular.. I mean, you have to know exactly how many lines are involved, in order to build an appropriate search expression.

Hope this helps. I can provide more detailed instructions if you provide more info, as Bob requested.
Post Reply