PDA

View Full Version : [SOLVED:] Find/Delete text in a document



mellowest
03-28-2018, 03:03 PM
Hello,

First. I want to thank the forum. It's really cool what you guys do for us newbies.

I have a two part question. Not sure if I should post separately, and I will if that makes sense, but I feel they are related.

So first. I have a block of text:

I want to keep this.
I want to delete this.
I want to keep this.

The end result would be, and I have no clue how to get it to delete the line in the middle.
I want to keep this.
I want to keep this.

Second:

I want to keep this.
IDnumber sometext1
I want to keep this.
IDnumber sometext2

The end result will be:

I want to keep this.
I want to keep this.

For the latter, I imagine it will be a while loop, but I can't figure out how to find the first string and then move to the end, not to mention deleting the resulting line in between. Please assume each line ends in a paragraph break.

Thank you for any help.

macropod
03-28-2018, 03:27 PM
1. Format all text as hidden
2. Use Find/Replace to remove the hidden attribute from:

I want to keep this.
3.
Use Find/Replace to delete all hidden text.
You could, of course, record the above as a macro.

mellowest
03-28-2018, 06:17 PM
Hi Paul. Thanks for the quick response. I will try this approach tomorrow. For the second part of my question, this is what my data looks like:
21942

So I would need to delete the lines that start with Service Locator until the line ends, after the number. Would the approach above be viable? Thanks again.

macropod
03-28-2018, 09:31 PM
If all you need to do is delete lines that start with 'Service Locator', all you need is a straightforward wildcard Find/Replace, where:
Find = ^13Service Locator*^13
Replace = ^p

mellowest
03-29-2018, 05:52 AM
Hi Paul,

My apologies, but the caret 13 is literal? I used the syntax as above and no results were returned. Thanks.

mellowest
03-29-2018, 06:00 AM
Ok. Realized ^sService Locator*^13 would work. Thank you.

macropod
03-29-2018, 01:12 PM
Realized ^sService Locator*^13 would work.
That suggests your lines don't start with 'Service Locator', but with a non-breaking space followed by 'Service Locator'.

mellowest
03-29-2018, 03:37 PM
Indeed. Thanks for the help.