It sure looks to me like Text -> Process Lines Containing… could do what you 
want.

1. Choose Find lines that do not contain:

2. Put the pattern you mention in the box.

3. Choose Delete matched lines

4. Make sure Copy to clipboard and Copy to new document are NOT checked.

5. Click Process

Doesn’t that do what you want? (Test with sample copies of your files.)

An approach using Extract could be to script it and add a step to unlink/delete 
the original file after the new one is created with the extractions; once the 
original file is deleted, the new one can be re-named with the original name.

Of course, it’s easy to picture doing this operation with a short script in 
Perl or Applescript, saved as a BBEdit text filter.

HTH

> On Nov 12, 2022, at 2:12 PM, Michael Kocher <[email protected]> wrote:
> 
> The problem with Extract is that it makes a new file, and I have a thousands 
> of files. Is there a way to do it within the original file?
> 
> On Saturday, November 12, 2022 at 3:23:13 PM UTC-6 [email protected] wrote:
> On 12 Nov 2022, at 16:09, Michael Kocher wrote: 
> 
> > I'm trying to use a multi-file search and replace using grep. I'm still 
> > pretty new to grep and BBEdit and could use some help. 
> > 
> > I can isolate the text I want to keep using this: 
> > 
> > <div class="page-content(?s).*?<div data-analytics-region="prev-next" 
> > 
> > Unfortunately, that's the content I want to keep. Is there a way to find 
> > everything *except* what that line pulls up and delete it? 
> 
> The "Extract" button might do the job for you here. (Leave the "Replace" 
> field blank.) 
> 
> R. 
> 
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "[email protected]" 
> rather than posting here. Follow @bbedit on Twitter: 
> <https://twitter.com/bbedit>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/d73aa5e5-11e5-4b3f-9bc8-30de68e2ccd2n%40googlegroups.com.


    — Bruce

_bruce__van_allen__santa_cruz_ca_





-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "[email protected]" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/EDC7782A-67D9-46B1-8A64-5F0C8449B50B%40cruzio.com.

Reply via email to